Skip to main content

Ansible module "iosxr_config"

·138 words·1 min
Linux
Rory
Author
Rory
Step by step the ladder is ascended

学习的时候搜到管理CISCO IOX 设备的ansible模块,“ iosxr_config – Manage Cisco IOS XR configuration sections“,记录下有空玩玩。

[student@workstation ~]$ ansible-doc -l | grep ios | grep cisco
[student@workstation ~]$ 
[student@workstation ~]$ ansible-doc -l | grep iosxr_config
iosxr_config                                           Manage Cisco IOS XR configuration sections          
[student@workstation ~]$ 
[student@workstation ~]$ 
[student@workstation ~]$ 
[student@workstation ~]$ 
[student@workstation ~]$ 
[student@workstation ~]$ ansible-doc iosxr_config


EXAMPLES:

- name: configure top level configuration
  iosxr_config:
    lines: hostname {{ inventory_hostname }}

- name: configure interface settings
  iosxr_config:
    lines:
      - description test interface
      - ip address 172.31.1.1 255.255.255.0
    parents: interface GigabitEthernet0/0/0/0

- name: load a config from disk and replace the current config
  iosxr_config:
    src: config.cfg
    replace: config
    backup: yes

- name: for idempotency, use full-form commands
  iosxr_config:
    lines:
      # - shut
      - shutdown
    # parents: int g0/0/0/1
    parents: interface GigabitEthernet0/0/0/1

- name: configurable backup path
  iosxr_config:
    src: config.cfg
    backup: yes
    backup_options:
      filename: backup.cfg
      dir_path: /home/user