Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Sprygada privateip

View GitHub Profile
@privateip
privateip / gist:04683a832259e4a7ffb7a5720b4d1c2c
Last active Jun 7, 2019
Test of Ansible Junos Netconf functionality with 2.8.0
View gist:04683a832259e4a7ffb7a5720b4d1c2c
################ INVENTORY FILE ############################################3
(ansible) [ansible-junos]$ cat inventory
[all:vars]
ansible_python_interpreter=python
[junos]
an-vsrx-02.ansible.eng.rdu2.redhat.com
[junos:vars]
ansible_network_os=junos
View network_cli.py
# (c) 2016 Red Hat Inc.
# (c) 2017 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 = """
---
author: Ansible Networking Team
View gist:3b62044eb15c5ffc29650072355d8953
---
- src: ansible-network.network-engine
- src: https://github.com/ansible-network/arista_eos
name: ansible-network.arista_eos
- src: https://github.com/ansible-network/cisco_ios
name: ansible-network.cisco_ios
(ansible) [~]$
View gist:89b47c0c908173283c812f932b389ee9
import paramiko
user = raw_input('Username: ')
password = raw_input('Password: ')
name = raw_input('Hostname: ')
command = raw_input('Command: ')
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
@privateip
privateip / gist:879683a0172415c408fb2afb82a97511
Created Apr 26, 2018
how to use ansible runner programatically
View gist:879683a0172415c408fb2afb82a97511
import os
import json
import tempfile
import subprocess
import ansible_runner
def run():
# create an Ansible playbook as a native Python dict object. Currently
@privateip
privateip / gist:2ab7bfc7b93eafe004d17bf21edc1f51
Created Jan 23, 2018
example netconf with native connection
View gist:2ab7bfc7b93eafe004d17bf21edc1f51
#!/usr/bin/python
# (c) 2018, Red Hat, Inc.
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
View gist:bb6677036adbde1ca7eaccd9fe0c0986
- hosts: an-nios-01
gather_facts: no
connection: local
vars:
provider:
host: an-nios-01.ansible.eng.rdu2.redhat.com
username: admin
password: admin
View gist:60b0a58721fd6b4354e8b5f5618bb15b

Example of network_cli

Updated: 27-Nov-2017

As the Ansible network team begins the transition towards implementing the network_cli connection plugin, we wanted to provide a sample implementation for module developers to use as a guide.

The document provides details on how to implement a module using the new

@privateip
privateip / gist:27177caa90005a59219c91bffeeac3d5
Created Nov 27, 2017
example ios implementation of network_cli
View gist:27177caa90005a59219c91bffeeac3d5
(ansible) [ansible-ios]$ play example.yaml -u ansible -k -vvv
ansible-playbook 2.5.0 (network-cli-example 5c88db3630) last updated 2017/11/27 16:18:59 (GMT -400)
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/sprygada/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/sprygada/Workspaces/ansible/lib/ansible
executable location = /home/sprygada/Workspaces/ansible/bin/ansible-playbook
python version = 2.7.14 (default, Nov 3 2017, 10:55:25) [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)]
Using /etc/ansible/ansible.cfg as config file
SSH password:
Parsed /etc/ansible/hosts inventory source with ini plugin
View gist:dd13b5747278ebcb19224ecd591c8632
---
# This parser will parse the output from 'show running-config' on Cisco NXOS.
#
# Command: show running-config
# Platform: nxos
#
# Returns:
# interfaces:
# name: The name of the interface
# ipv4: The IPv4 address (if configured)
You can’t perform that action at this time.