In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about Ansible playbook backup Cisco ios configuration, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's follow the editor to have a look.
The hosts file contains the host asset information
Secrets.yml is used to place the user name and password
Success_backup.yml is the yaml file to be executed
192.168.60.120.txt is a post-execution production file.
# hosts
[ios_device]
192.168.60.120
# secrets.yml
-
Creds:
Username: cisco
Password: cisco
Auth_pass: cisco
# success_backup.yml
-
-hosts: ios_device
Gather_facts: no
Connection: local
Tasks:
-name: OBTAIN LOGIN CREDENTIALS # get login credentials (username and password)
Include_vars: secrets.yml
-name: DEFINE PROVIDER # defines a provider
Set_fact:
Provider:
Host: "{{inventory_hostname}}"
Username: "{{creds ['username']}}"
Password: "{{creds ['password']}}"
Auth_pass: "{{creds ['auth_pass']}}"
-name: show run # View configuration file
Ios_command:
Provider: "{{provider}}"
Authorize: yes
Commands:
-show run
Register: output
-debug: var=output.stdout_lines # outputs the output variable
-name: save the output content to a file # put the content locally on the control machine
Local_action: copy content= {{output.stdout_lines}} dest= ". / {{inventory_hostname}} .txt"
-
Note:
The host where the 1.Ansible is located should be able to communicate with cisco ios devices with ssh
2.cisco ios configuration ssh process:
Ip domain-name [cisco.com] / / cisco.com this is filled in according to your actual situation.
Cryto key generate
Line vty 0 4
Login local
Transparent input ssh
Ip ssh time-out 120 / / modify timeout
Ip ssh authentication-retries 1 / / modify the number of recertification times.
Ip ssh version 2 / / modified version
The above is what the Ansible playbook backup Cisco ios configuration is like, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.