ansible/test/integration/targets/exos_config/tests/common/sysname.yaml
Ruturaj Vyawahare f872c61712 Added integration tests for the following modules: (#55523)
- exos_facts
- exos_command
- exos_config
2019-08-28 10:48:32 -04:00

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"