1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/nxos_aaa_server/tests/common/tacacs.yaml
Nathaniel Case c371ed8d30
nxos tests to use network_cli (#34474)
* Fix over-byte

* Fix nxos_l2_interface docs

* Update connections for tasks

* Add default ssh port

* Only report provider when using connection=local

* Send empty provider when connection=network_cli

* Fix find tasks
2018-01-05 12:39:04 -05:00

103 lines
2.4 KiB
YAML

---
- debug: msg="START connection={{ ansible_connection }} nxos_aaa_server tacacs.yaml sanity test"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: "Enable feature tacacs+"
nxos_feature:
feature: tacacs+
state: enabled
provider: "{{ connection }}"
- name: "Setup"
nxos_aaa_server: &remove
server_type: tacacs
deadtime: default
server_timeout: default
directed_request: default
state: default
provider: "{{ connection }}"
ignore_errors: yes
- block:
- name: "Configure tacacs server defaults"
nxos_aaa_server: &configure_default_tacacs
server_type: tacacs
state: present
provider: "{{ connection }}"
register: result
- name: "Check Idempotence"
nxos_aaa_server: *configure_default_tacacs
register: result
- assert: &false
that:
- "result.changed == false"
- name: "Configure tacacs server non defaults"
nxos_aaa_server: &configure_tacacs_non_default
server_type: tacacs
server_timeout: 9
deadtime: 20
directed_request: enabled
state: present
provider: "{{ connection }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Check Idempotence"
nxos_aaa_server: *configure_tacacs_non_default
register: result
- assert: *false
- name: "Remove tacacs server configuration"
nxos_aaa_server: *remove
register: result
- assert: *true
- name: "Configure tacacs server with global key"
nxos_aaa_server: &configure_tacacs_global_key
server_type: tacacs
encrypt_type: 7
global_key: test_key
state: present
provider: "{{ connection }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_aaa_server: *configure_tacacs_global_key
register: result
- assert: *false
- name: "Remove tacacs server configuration"
nxos_aaa_server: *remove
register: result
- assert: *true
rescue:
- debug: msg="connection={{ ansible_connection }} nxos_aaa_server failure detected"
always:
- name: "Remove tacacs server configuration"
nxos_aaa_server: *remove
register: result
- name: "Disable feature tacacs+"
nxos_feature:
feature: tacacs+
state: disabled
provider: "{{ connection }}"
- debug: msg="END connection={{ ansible_connection }} nxos_aaa_server tacacs.yaml sanity test"