Last active
June 2, 2021 22:09
-
-
Save mbruzek/862922f1193b2fac6f2d9d964a60952e to your computer and use it in GitHub Desktop.
This file contains 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.ini | |
[ios] | |
sg250a ansible_host=192.168.1.254 | |
[ios:vars] | |
ansible_become=yes | |
ansible_become_method=enable | |
ansible_connection=ansible.netcommon.network_cli | |
ansible_network_os=cisco.ios.ios | |
- - - - - | |
- name: Set the configuration on a Cisco switch | |
become: yes | |
hosts: ios | |
gather_facts: no | |
vars: | |
backup_path: backup/files/here | |
tasks: | |
- name: Set the startup configuration | |
cisco.ios.ios_config: | |
backup: yes | |
backup_options: | |
filename: 2021_06_02_cisco_backup.txt | |
dir_path: "{{ backup_path }}" | |
src: cisco_configuration.txt | |
save_when: always | |
- - - - - | |
cisco_configuration.txt | |
hostname newhostname | |
- - - - - - - - - | |
ansible-playbook -vvv -i hosts.ini -u automater -k -K set_startup_config.yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment