f872c61712
- exos_facts - exos_command - exos_config
35 lines
904 B
YAML
35 lines
904 B
YAML
---
|
|
- debug: msg="START common/sysname.yaml"
|
|
|
|
- name: Get intial SysName
|
|
exos_command:
|
|
commands: show switch | grep SysName
|
|
register: sysname_init
|
|
|
|
- name: configure SNMP system name
|
|
exos_config:
|
|
lines: configure snmp sysName "{{ inventory_hostname }}"
|
|
register: result
|
|
- assert:
|
|
that:
|
|
- "result.commands[0] is search('configure')"
|
|
- "result.changed == True"
|
|
|
|
- name: Idempotency of SNMP system name configuration
|
|
exos_config:
|
|
lines: configure snmp sysName "{{ inventory_hostname }}"
|
|
register: result
|
|
- assert:
|
|
that:
|
|
- "result.changed == False"
|
|
- set_fact: old_sysname='{{ sysname_init.stdout[0] | regex_search('([^\s]+$)') }}'
|
|
|
|
- name: Restore inital sysName
|
|
exos_config:
|
|
lines: 'configure snmp sysName {{ old_sysname }}'
|
|
|
|
- name: Save the configuration to startup
|
|
exos_config:
|
|
save_when: modified
|
|
|
|
- debug: msg="END common/sysname.yaml"
|