You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/exos_config/tests/common/sysname.yaml

36 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"