Skip to content

Instantly share code, notes, and snippets.

@victorock
victorock / snmpv2.py
Created June 15, 2018 10:14
Ansible's Inventory Plugin for network discovery using snmp
# Copyright (c) 2018 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
name: "snmp"
plugin_type: "inventory"
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - role_dir: the directory where the role exists (default = $PWD)
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2007, 2012 Red Hat, Inc
# Michael DeHaan <michael.dehaan@gmail.com>
# Seth Vidal <skvidal@fedoraproject.org>
# Victor da Costa <victorockeiro@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
{
"data": [
[
[
"uuid",
"d39ce7ed-6726-40d5-a570-9fc790654cf2"],
[
"set",
[]],
"0000eee79cd3d540",
#
# (c) 2019 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
{
"details": [
{
"command": "show vlan | json",
"parsed": {
"vlan": {
"vlanbrief": [
{
"vlanshowbr-vlanstate": "active",
"vlanshowplist-ifidx": [
@victorock
victorock / nxos_ping_info.py
Created November 6, 2019 15:56
nxos_ping_info.py
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
Nov 16 21:32:28 ip-10-1-0-100.eu-central-1.compute.internal systemd[1]: Reloading.
Nov 16 21:32:28 ip-10-1-0-100.eu-central-1.compute.internal systemd[1]: Starting The nginx HTTP and reverse proxy server...
-- Subject: Unit nginx.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has begun starting up.
Nov 16 21:32:28 ip-10-1-0-100.eu-central-1.compute.internal nginx[28603]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Nov 16 21:32:28 ip-10-1-0-100.eu-central-1.compute.internal nginx[28603]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Nov 16 21:32:28 ip-10-1-0-100.eu-central-1.compute.internal systemd[1]: Failed to parse PID from file /run/nginx.pid: Success
---
filters:
extattrs: {}
view: null
---
- name: "Install infoblox-client in tower nodes"
hosts: tower
become: true
gather_facts: false
tasks:
- name: "Install infoblox-client in ansible's venv"
pip:
name: "infoblox-client"
umask: "0022"