Created
November 19, 2019 11:15
-
-
Save NilashishC/e2452aa7e15ab3623e68d6b9fe1d4a5f 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: aws_csr | |
gather_facts: no | |
vars: | |
backup_directory: ~/Desktop/csr | |
tasks: | |
- name: Create Backup Directory | |
file: | |
path: "{{ backup_directory }}" | |
state: directory | |
- name: Take backup of running config | |
ios_config: | |
backup: yes | |
backup_options: | |
dir_path: "{{ backup_directory }}" | |
tags: | |
- initial_backup | |
- name: Update interface description | |
ios_config: | |
lines: | |
- description 'TEST_INTERFACE_1' | |
parents: interface GigabitEthernet1 | |
register: result | |
tags: | |
- changes | |
- name: Take backup if the above task resulted in changes | |
ios_config: | |
backup: yes | |
backup_options: | |
dir_path: "{{ backup_directory }}" | |
when: result.changed == True | |
tags: | |
- changes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment