2017-10-25 17:41:23 +02:00
|
|
|
---
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_ntp_options sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-10-25 17:41:23 +02:00
|
|
|
|
|
|
|
- name: "Apply default ntp config"
|
|
|
|
nxos_ntp_options: &default
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-10-25 17:41:23 +02:00
|
|
|
state: absent
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: Configure ntp with master and default stratum
|
|
|
|
nxos_ntp_options: &configure_master_default_stratum
|
|
|
|
master: true
|
|
|
|
logging: true
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-10-25 17:41:23 +02:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "Check Idempotence - Configure ntp with master and default stratum"
|
|
|
|
nxos_ntp_options: *configure_master_default_stratum
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
2018-04-13 12:17:32 +02:00
|
|
|
- name: Configure ntp with master and non-default stratum
|
|
|
|
nxos_ntp_options: &configure_master_non_default_stratum
|
2017-10-25 17:41:23 +02:00
|
|
|
master: true
|
2018-04-13 12:17:32 +02:00
|
|
|
stratum: 10
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-04-13 12:17:32 +02:00
|
|
|
state: present
|
2017-10-25 17:41:23 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
2018-04-13 12:17:32 +02:00
|
|
|
- name: "Check Idempotence - Configure ntp with master and non-default stratum"
|
|
|
|
nxos_ntp_options: *configure_master_non_default_stratum
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Configure ntp with master and no logging
|
|
|
|
nxos_ntp_options: &configure_no_log
|
2017-10-25 17:41:23 +02:00
|
|
|
master: true
|
|
|
|
stratum: 10
|
2018-04-13 12:17:32 +02:00
|
|
|
logging: false
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-10-25 17:41:23 +02:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
2018-04-13 12:17:32 +02:00
|
|
|
- name: "Check Idempotence - Configure ntp with master and no logging"
|
|
|
|
nxos_ntp_options: *configure_no_log
|
2017-10-25 17:41:23 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2018-04-13 12:17:32 +02:00
|
|
|
- name: Configure ntp with logging and no master
|
|
|
|
nxos_ntp_options: &configure_no_master
|
|
|
|
master: false
|
2017-10-25 17:41:23 +02:00
|
|
|
logging: true
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-04-13 12:17:32 +02:00
|
|
|
state: present
|
2017-10-25 17:41:23 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
2018-04-13 12:17:32 +02:00
|
|
|
- name: "Check Idempotence - Configure ntp with logging and no master"
|
|
|
|
nxos_ntp_options: *configure_no_master
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: "Configure ntp with master and non-default stratum again"
|
|
|
|
nxos_ntp_options: *configure_master_non_default_stratum
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Remove ntp options
|
|
|
|
nxos_ntp_options: *default
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence - Remove"
|
|
|
|
nxos_ntp_options: *default
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-10-25 17:41:23 +02:00
|
|
|
always:
|
|
|
|
- name: Cleanup ntp config
|
|
|
|
nxos_ntp_options: *default
|
|
|
|
register: result
|
|
|
|
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_ntp_options sanity test"
|