2018-06-28 04:41:45 +00:00
|
|
|
---
|
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_gir sanity test"
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2018-06-28 04:41:45 +00:00
|
|
|
|
|
|
|
- set_fact: gir_run="true"
|
|
|
|
- set_fact: gir_run="false"
|
|
|
|
when: platform is search("N35")
|
2017-12-16 04:11:49 +00:00
|
|
|
#- name: "Setup"
|
|
|
|
# nxos_gir: &setup
|
|
|
|
# system_mode_maintenance: false
|
2018-06-28 04:41:45 +00:00
|
|
|
# provider: "{{ connection }}"
|
2017-12-16 04:11:49 +00:00
|
|
|
# ignore_errors: yes
|
2018-06-28 04:41:45 +00:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: "Put system in maintenance mode with reload reset reason"
|
|
|
|
nxos_gir: &reset_reason
|
|
|
|
system_mode_maintenance_on_reload_reset_reason: manual_reload
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_gir: *reset_reason
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: "Remove reload reason"
|
|
|
|
nxos_gir: &remove_reason
|
|
|
|
system_mode_maintenance_on_reload_reset_reason: manual_reload
|
|
|
|
state: absent
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_gir: *remove_reason
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: "Put system in maintenance mode with timeout"
|
|
|
|
nxos_gir: &mtime
|
|
|
|
system_mode_maintenance_timeout: 30
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_gir: *mtime
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: "Remove maintenance mode timeout"
|
|
|
|
nxos_gir: &remove_timeout
|
|
|
|
system_mode_maintenance_timeout: 30
|
|
|
|
state: absent
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_gir: *remove_timeout
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-12-16 04:11:49 +00:00
|
|
|
# - name: "Put system in maintenance mode"
|
|
|
|
# nxos_gir: &configure_system_mode_maintenance
|
|
|
|
# system_mode_maintenance: true
|
2018-06-28 04:41:45 +00:00
|
|
|
# provider: "{{ connection }}"
|
2017-12-16 04:11:49 +00:00
|
|
|
# register: result
|
|
|
|
#
|
|
|
|
# - assert: *true
|
2018-06-28 04:41:45 +00:00
|
|
|
|
|
|
|
when: gir_run
|
|
|
|
|
|
|
|
rescue:
|
|
|
|
|
|
|
|
- debug: msg="connection={{ ansible_connection }} nxos_gir failure detected"
|
|
|
|
|
|
|
|
always:
|
|
|
|
|
|
|
|
- name: "Remove snapshots"
|
|
|
|
nxos_snapshot:
|
|
|
|
action: delete_all
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: "Remove other config1"
|
|
|
|
nxos_config:
|
|
|
|
lines: no configure maintenance profile normal-mode
|
|
|
|
match: none
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: "Remove other config2"
|
|
|
|
nxos_config:
|
|
|
|
lines: no configure maintenance profile maintenance-mode
|
|
|
|
match: none
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2017-12-16 04:11:49 +00:00
|
|
|
# - name: "Put system back in normal mode"
|
|
|
|
# nxos_gir: *setup
|
|
|
|
# register: result
|
2018-06-28 04:41:45 +00:00
|
|
|
# ignore_errors: yes
|
|
|
|
|
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_gir sanity test"
|