Created
February 9, 2017 15:31
-
-
Save robphoenix/5ff6aed90686bf7458cf5c730a1dbd7b 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
--- | |
- name: Create tmp Directory | |
hosts: 127.0.0.1 | |
connection: local | |
tasks: | |
- name: Create tmp Directory | |
file: path=../../tmp state=directory | |
- name: Fetch running-config | |
gather_facts: no | |
hosts: stage_2_dev_1 | |
tasks: | |
- name: Execute write mem | |
ios_command: | |
provider: "{{ provider }}" | |
commands: | |
- wr mem | |
register: output | |
- debug: | |
var: output | |
- name: Execute 'show run' command | |
ios_command: | |
provider: "{{ provider }}" | |
commands: | |
- show run | |
register: output | |
- name: Write 'show run' to file | |
template: | |
src: output.txt.j2 | |
dest: "../../tmp/{{ inventory_hostname }}-pre-running-config.txt" | |
- name: Move files | |
hosts: 127.0.0.1 | |
connection: local | |
tasks: | |
- name: Delete directory | |
file: path=./backups/running_configs state=absent | |
- name: Move files to shared directory | |
command: mv ../../tmp ./backups/running_configs | |
- name: Remove tmp Directory | |
file: path=../../tmp state=absent | |
- name: Reload | |
gather_facts: no | |
hosts: stage_2_dev_1 | |
tasks: | |
- name: Reload in 15 minutes | |
ntc_reboot: | |
platform: cisco_ios_ssh | |
username: "{{ ansible_user }}" | |
password: "{{ ansible_password }}" | |
host: "{{ ansible_host }}" | |
confirm: true | |
timer: 15 | |
register: output | |
- debug: | |
var: output | |
- name: Change transport settings | |
ios_config: | |
provider: "{{ provider }}" | |
lines: | |
- transport input ssh | |
- transport output ssh | |
parents: line vty 0 15 | |
register: output | |
- debug: | |
var: output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment