This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: ios_routers | |
gather_facts: false | |
connection: local | |
tasks: | |
- name: run show version on ios device | |
ios_command: | |
commands: | |
- show version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ansible)[network]$ ansible-playbook change_hostname.yaml --check | |
PLAY [veos01] ****************************************************************** | |
TASK [eos_config] ************************************************************** | |
changed: [veos01] | |
TASK [debug] ******************************************************************* | |
ok: [veos01] => { | |
"result": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: ops01 | |
gather_facts: no | |
vars: | |
cli: | |
host: "{{ inventory_hostname }}" | |
port: 2222 | |
username: netop | |
password: netop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ansible)[ansible-nxos]$ cat show.yaml | |
--- | |
- hosts: nxos03 | |
gather_facts: no | |
connection: local | |
tasks: | |
- name: return show commands output | |
nxos_command: | |
commands: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ansible)[ansible-ios]$ ansible -m ios_facts -a "host=ios01 username=cisco password=cisco authorize=true gather_subset=all" ios01 | |
ios01 | SUCCESS => { | |
"ansible_facts": { | |
"ansible_net_all_ipv4_addresses": [ | |
"172.26.4.30" | |
], | |
"ansible_net_all_ipv6_addresses": [], | |
"ansible_net_config": "Building configuration...\n\nCurrent configuration : 3205 bytes\n!\n! Last configuration change at 20:15:33 UTC Tue May 24 2016 by ********\n!\nversion 15.6\nservice timestamps debug datetime msec\nservice timestamps log datetime msec\nno service password-encryption\n!\nhostname veos01\n!\nboot-start-marker\nboot-end-marker\n!\n!\nvrf definition Mgmt-intf\n !\n address-family ipv4\n exit-address-family\n !\n address-family ipv6\n exit-address-family\n!\nno logging buffered\nlogging console informational\nenable password ********\n!\nno aaa new-model\nethernet lmi ce\n!\n!\n!\nmmi polling-interval 60\nno mmi auto-configure\nno mmi pvc\nmmi snmp-timeout 180\n!\n!\n!\n!\n!\n!\n!\n!\n!\n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# (c) 2016 Peter Sprygada <[email protected]> | |
# | |
# 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. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: configure vty settings | |
hosts: ios | |
connection: local | |
gather_facts: no | |
tasks: | |
- name: set vty settings | |
ios_config: | |
lines: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: show mac address-table | |
register: output | |
nxos_command: | |
commands: | |
- show mac address-table | json | |
provider: "{{ cli }}" | |
register: output | |
- name: copy output to file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ansible)[ansible-ios]$ ansible -m ios_command -a "host={{ inventory_hostname }} username=cisco password=cisco commands='show interfaces'" --connection local ios | |
ios02 | SUCCESS => { | |
"changed": false, | |
"stdout": [ | |
"GigabitEthernet0/0 is up, line protocol is up \n Hardware is iGbE, address is fa16.3e50.7f24 (bia fa16.3e50.7f24)\n Description: OOB Management\n Internet address is 172.26.4.31/24\n MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec, \n reliability 255/255, txload 1/255, rxload 1/255\n Encapsulation ARPA, loopback not set\n Keepalive set (10 sec)\n Full Duplex, Auto Speed, link type is auto, media type is RJ45\n output flow-control is unsupported, input flow-control is unsupported\n ARP type: ARPA, ARP Timeout 04:00:00\n Last input 00:00:00, output 00:00:00, output hang never\n Last clearing of \"show interface\" counters never\n Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0\n Queueing strategy: fifo\n Output queue: 0/40 (size/max)\n 5 minute |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ansible)[ansible-asa]$ ansible --version | |
ansible 2.2.0 (working 7579df33ce) last updated 2016/08/10 15:39:41 (GMT -400) | |
lib/ansible/modules/core: (working f3e761f0c8) last updated 2016/08/11 11:19:11 (GMT -400) | |
lib/ansible/modules/extras: (working 57c142b6ed) last updated 2016/08/02 15:17:56 (GMT -400) | |
config file = /etc/ansible/ansible.cfg | |
configured module search path = Default w/o overrides | |
(ansible)[ansible-asa]$ | |
(ansible)[ansible-asa]$ | |
(ansible)[ansible-asa]$ | |
(ansible)[ansible-asa]$ cat show.yaml |
OlderNewer