2017-12-16 04:11:49 +00:00
|
|
|
---
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_aaa_server radius.yaml sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-12-16 04:11:49 +00:00
|
|
|
|
|
|
|
- name: "Setup"
|
|
|
|
nxos_aaa_server: &remove
|
|
|
|
server_type: radius
|
|
|
|
deadtime: default
|
|
|
|
server_timeout: default
|
|
|
|
directed_request: default
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-12-16 04:11:49 +00:00
|
|
|
state: default
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: "Configure radius server defaults"
|
|
|
|
nxos_aaa_server: &configure_default_radius
|
|
|
|
server_type: radius
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-12-16 04:11:49 +00:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_aaa_server: *configure_default_radius
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: "Configure radius server non defaults"
|
|
|
|
nxos_aaa_server: &configure_radius_non_default
|
|
|
|
server_type: radius
|
|
|
|
server_timeout: 9
|
|
|
|
deadtime: 20
|
|
|
|
directed_request: enabled
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-12-16 04:11:49 +00:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_aaa_server: *configure_radius_non_default
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: "Remove radius server configuration"
|
|
|
|
nxos_aaa_server: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Configure radius server with global key"
|
|
|
|
nxos_aaa_server: &configure_radius_global_key
|
|
|
|
server_type: radius
|
|
|
|
encrypt_type: 7
|
|
|
|
global_key: test_key
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-12-16 04:11:49 +00:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_aaa_server: *configure_radius_global_key
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: "Remove radius server configuration"
|
2018-04-02 11:56:06 +00:00
|
|
|
nxos_aaa_server: &rad_def
|
2017-12-16 04:11:49 +00:00
|
|
|
server_type: radius
|
|
|
|
deadtime: default
|
|
|
|
server_timeout: default
|
|
|
|
global_key: default
|
|
|
|
directed_request: default
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-12-16 04:11:49 +00:00
|
|
|
state: default
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
2018-04-02 11:56:06 +00:00
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_aaa_server: *rad_def
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-12-16 04:11:49 +00:00
|
|
|
rescue:
|
|
|
|
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="connection={{ ansible_connection }} nxos_aaa_server failure detected"
|
2017-12-16 04:11:49 +00:00
|
|
|
|
|
|
|
always:
|
|
|
|
- name: "Remove radius server configuration"
|
|
|
|
nxos_aaa_server: *remove
|
|
|
|
register: result
|
|
|
|
|
2018-04-02 11:56:06 +00:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_aaa_server radius.yaml sanity test"
|