In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
There is no introduction to ansible.
This example mainly introduces several methods of configuring ios interface by ansible, or which modules can be used to configure the interface.
1. List of hosts. This test takes one host as an example.
[root@Ansible-01 ansible] # cat hosts[cisco] 172.16.254.130 ansible_connection=local
2.playbooks content
[root@Ansible-01 interface] # cat interface-phy.yml-name: interface config hosts: cisco # vars: # creds: # username: "{{username}}" # password: "{{password}}" gather_facts: no tasks:-name: action interface G1-2 configure ios_config: lines:-no shutdown-switch mode trunk-switch Trunk allow vlan all-do wr parents: interface range gigabitEthernet 1-0-1-2-name: action interface G3 configuration ios_l2_interface: name: GigabitEthernet1/0/3 mode: access access_vlan: 100-name: action interface G3 configuration ios_l2_interface: name: GigabitEthernet1/0/4 mode: trunk native_vlan: 100 trunk_allowed_vlans: 10-255 -name: save configuration ios_command: commands:-wr
3. Execute playbooks
[root@Ansible-01 interface] # ansible-playbook interface-phy.yml-u admin-k SSH password: PLAY [interface config] * * * TASK [action interface G1-2 configure] * * changed: [172.16.254.130] TASK [action interface G3 configuration] * Changed: [172.16.254.130] TASK [action interface G4 configuration] * changed: [172.16 .254.130] TASK [save configuration] * ok : [172.16.254.130] PLAY RECAP * * 172.16.254.130: ok=4 changed=3 unreachable=0 failed=0
4. View the execution effect
Interface GigabitEthernet1/0/1 switchport mode trunks / GigabitEthernet1/0/2 switchport mode trunks / GigabitEthernet1/0/3 switchport access vlan 100 switchport mode accessory interface GigabitEthernet1/0/4 switchport trunk native vlan 100 switchport trunk allowed vlan 10-255 switchport mode trunk! It can be seen that both ios_config and ios_l2_interface modules can be operated, and only layer 3 interfaces can use ios_comfig or ios_l3_interface modules.
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.