2017-08-14 22:09:16 +02:00
|
|
|
---
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_ntp sanity test"
|
2017-08-14 22:09:16 +02:00
|
|
|
|
|
|
|
- name: Setup - Remove ntp if configured
|
|
|
|
nxos_ntp: &remove
|
|
|
|
server: 1.2.3.4
|
|
|
|
key_id: 32
|
|
|
|
prefer: disabled
|
|
|
|
vrf_name: management
|
2018-05-30 19:03:20 +02:00
|
|
|
source_addr: 192.0.2.5
|
2017-08-14 22:09:16 +02:00
|
|
|
state: absent
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: Configure ntp
|
|
|
|
nxos_ntp: &config
|
|
|
|
server: 1.2.3.4
|
|
|
|
key_id: 32
|
|
|
|
prefer: enabled
|
|
|
|
vrf_name: management
|
2018-05-30 19:03:20 +02:00
|
|
|
source_addr: 192.0.2.5
|
2017-08-14 22:09:16 +02:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: Idempotence Check
|
|
|
|
nxos_ntp: *config
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
2018-04-26 08:39:46 +02:00
|
|
|
- name: Configure ntp with some defaults
|
|
|
|
nxos_ntp: &config1
|
|
|
|
peer: 1.2.3.4
|
|
|
|
key_id: default
|
|
|
|
prefer: enabled
|
|
|
|
vrf_name: default
|
|
|
|
source_addr: default
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Idempotence Check
|
|
|
|
nxos_ntp: *config1
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-08-14 22:09:16 +02:00
|
|
|
- name: Remove ntp config
|
|
|
|
nxos_ntp: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Remove Idempotence Check
|
|
|
|
nxos_ntp: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2018-04-26 08:39:46 +02:00
|
|
|
- name: Configure ntp again
|
|
|
|
nxos_ntp: &config2
|
|
|
|
source_int: Ethernet1/3
|
|
|
|
peer: 1.2.3.4
|
|
|
|
prefer: enabled
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Idempotence Check
|
|
|
|
nxos_ntp: *config2
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Remove source interface
|
|
|
|
nxos_ntp: &config3
|
|
|
|
source_int: default
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Idempotence Check
|
|
|
|
nxos_ntp: *config3
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Remove ntp
|
|
|
|
nxos_ntp: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Remove Idempotence Check
|
|
|
|
nxos_ntp: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-08-14 22:09:16 +02:00
|
|
|
always:
|
|
|
|
- name: Remove ntp config
|
|
|
|
nxos_ntp: *remove
|
|
|
|
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_ntp sanity test"
|