2017-12-16 05:11:49 +01:00
|
|
|
---
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_aaa_server tacacs.yaml sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-12-16 05:11:49 +01:00
|
|
|
|
|
|
|
- name: "Enable feature tacacs+"
|
|
|
|
nxos_feature:
|
|
|
|
feature: tacacs+
|
|
|
|
state: enabled
|
|
|
|
|
|
|
|
- name: "Setup"
|
|
|
|
nxos_aaa_server: &remove
|
|
|
|
server_type: tacacs
|
|
|
|
deadtime: default
|
|
|
|
server_timeout: default
|
|
|
|
directed_request: default
|
|
|
|
state: default
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: "Configure tacacs server defaults"
|
|
|
|
nxos_aaa_server: &configure_default_tacacs
|
|
|
|
server_type: tacacs
|
|
|
|
state: present
|
|
|
|
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
|
|
|
|
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
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_aaa_server: *configure_tacacs_global_key
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: "Remove tacacs server configuration"
|
2018-04-02 13:56:06 +02:00
|
|
|
nxos_aaa_server: &tac_def
|
|
|
|
server_type: tacacs
|
|
|
|
deadtime: default
|
|
|
|
server_timeout: default
|
|
|
|
global_key: default
|
|
|
|
directed_request: default
|
|
|
|
state: default
|
2017-12-16 05:11:49 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
2018-04-02 13:56:06 +02:00
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_aaa_server: *tac_def
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-12-16 05:11:49 +01:00
|
|
|
rescue:
|
|
|
|
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="connection={{ ansible_connection }} nxos_aaa_server failure detected"
|
2017-12-16 05:11:49 +01:00
|
|
|
|
|
|
|
always:
|
|
|
|
|
|
|
|
- name: "Remove tacacs server configuration"
|
|
|
|
nxos_aaa_server: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: "Disable feature tacacs+"
|
|
|
|
nxos_feature:
|
|
|
|
feature: tacacs+
|
|
|
|
state: disabled
|
|
|
|
|
2018-04-02 13:56:06 +02:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_aaa_server tacacs.yaml sanity test"
|