2017-10-25 17:41:23 +02:00
|
|
|
---
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_ntp_auth sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-10-25 17:41:23 +02:00
|
|
|
|
|
|
|
- name: Configure text ntp authentication
|
|
|
|
nxos_ntp_auth: &setup
|
|
|
|
key_id: 32
|
|
|
|
md5string: hello
|
|
|
|
state: absent
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: Configure text ntp authentication
|
|
|
|
nxos_ntp_auth: &configure_text
|
|
|
|
key_id: 32
|
|
|
|
md5string: hello
|
2018-04-17 14:25:05 +02:00
|
|
|
authentication: off
|
2017-10-25 17:41:23 +02:00
|
|
|
state: present
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: Remove text ntp authentication
|
|
|
|
nxos_ntp_auth: &remove_text
|
|
|
|
key_id: 32
|
|
|
|
md5string: hello
|
2018-04-17 14:25:05 +02:00
|
|
|
authentication: off
|
2017-10-25 17:41:23 +02:00
|
|
|
state: absent
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Configure encrypt ntp authentication
|
|
|
|
nxos_ntp_auth: &configure_encrypt
|
|
|
|
key_id: 32
|
|
|
|
md5string: hello
|
|
|
|
auth_type: encrypt
|
|
|
|
state: present
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence - Configure encrypt ntp authentication"
|
|
|
|
nxos_ntp_auth: *configure_encrypt
|
|
|
|
register: result
|
|
|
|
|
2018-04-17 14:25:05 +02:00
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Turn on authentication
|
|
|
|
nxos_ntp_auth: &authon
|
|
|
|
authentication: on
|
|
|
|
state: present
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence - Turn on authentication"
|
|
|
|
nxos_ntp_auth: *authon
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Turn off authentication
|
|
|
|
nxos_ntp_auth: &authoff
|
|
|
|
authentication: off
|
|
|
|
state: present
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence - Turn off authentication"
|
|
|
|
nxos_ntp_auth: *authoff
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Add trusted key
|
|
|
|
nxos_ntp_auth: &tkey
|
|
|
|
key_id: 32
|
|
|
|
trusted_key: true
|
|
|
|
state: present
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence - Add trusted key"
|
|
|
|
nxos_ntp_auth: *tkey
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Remove trusted key
|
|
|
|
nxos_ntp_auth: &rtkey
|
|
|
|
key_id: 32
|
|
|
|
trusted_key: false
|
|
|
|
state: present
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence - Remove trusted key"
|
|
|
|
nxos_ntp_auth: *rtkey
|
|
|
|
register: result
|
|
|
|
|
2017-10-25 17:41:23 +02:00
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Remove encrypt ntp authentication
|
|
|
|
nxos_ntp_auth: &remove_encrypt
|
|
|
|
key_id: 32
|
|
|
|
md5string: hello
|
|
|
|
auth_type: encrypt
|
|
|
|
authentication: on
|
|
|
|
state: absent
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
2018-04-17 14:25:05 +02:00
|
|
|
- name: "Check Idempotence - Remove encrypt ntp authentication"
|
|
|
|
nxos_ntp_auth: *remove_encrypt
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-10-25 17:41:23 +02:00
|
|
|
always:
|
|
|
|
- name: Cleanup ntp auth config
|
|
|
|
nxos_ntp_auth: *setup
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_ntp_auth sanity test"
|