Creating directories for Running and Startup configuration
Creating directories for Running and Startup configuration
- So, here, we're going to take some backup of the targeted decvice
configuration.
tasks:
- name: "Play-1: Task1 - Collection facts from the localhost"
ansible.builtin.setup:
filter:
- "ansible_date_time"
register: output
tasks:
- name: "Play-2: Task1 - Pull Configurations from Remote Device"
napalm_get_facts:
hostname: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
dev_os: "{{ napalm_platform }}"
filter: ["config"]
register: result
- So, here, you can see that the RUNNING_CONFIG and the STARTUP_CONFIG output
of the targeted devices.
NOTE:
- So, we're now going to create two different directories:
4. MODIFYING THE PLAYBOOK (FOR CREATING TWO DIRECTORIES FOR - RUNNING_CONFIG &
STARTUP_CONFIG):
- Now, let us try to split up the backup and store the RUNNING_CONFIG file on
one directory and the STARTUP_CONFIG file on
another directory.
[root@localhost My-Automation-Stuff2]# cat example14-run_config_backup.yml
---
tasks:
- name: "Play-1: Task1 - Collection facts from the localhost"
ansible.builtin.setup:
filter:
- "ansible_date_time"
register: output
tasks:
- name: "Play-2: Task1 - Pull Configurations from Remote Device"
napalm_get_facts:
hostname: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
dev_os: "{{ napalm_platform }}"
filter: ["config"]
register: result
PLAY RECAP
***********************************************************************************
****
arista1 : ok=1 changed=0 unreachable=0 failed=0
skipped=0 rescued=0 ignored=0
ios1 : ok=3 changed=2 unreachable=0 failed=0
skipped=0 rescued=0 ignored=0
localhost : ok=3 changed=1 unreachable=0 failed=0
skipped=0 rescued=0 ignored=0
- So, let us now save the configurations of the running_config and the
startup_config on their respective directories and that
is going to be covered in the very next topic using the COPY MODULE.
***********************************************************************************
****************************************************
X-X-X-X-X