Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

---

- name: Test IOS Facts


connection: network_cli
gather_facts: false
hosts: all
tasks:

- name: Get config for IOS devices


ios_facts:
gather_subset: all

- name: Display the config


debug:
msg: "The hostname is {{ ansible_net_hostname }} and the OS is
{{ ansible_net_version }}"

- name: Change hostname


ios_config:
backup: yes
lines:
- hostname R1

- name: Get changed config for IOS devices


ios_facts:
gather_subset: all

- name: Display the changed config


debug:
msg: "The new hostname is {{ ansible_net_hostname }} and the OS is
{{ ansible_net_version }}"

# RUN THE PLAYBOOK WITH THIS COMMAND


##
### SINGLE Command outlining this:
### ansible all -i LON-RTR-1-11, -c network_cli -u admin -k -m ios_facts -e
ansible_network_os=ios

#### ansible-playbook -i LON-RTR-1-11, -u admin -k -e ansible_network_os=ios


Ansible-Playbook-IOSDevices-4.yml

You might also like