mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
meraki_config_template - Enable check mode (#54502)
* Add support for check mode * Check mode returns proper changed status - Added is_template_valid() - Restructured check_mode so it will always return data - Check mode should show proper changed status - Code is untested and integration tests need to be expanded * Fix deleting networks - Add integration tests for deleting networks - Refine tests based on changed/unchanged * Remove one task from integration test
This commit is contained in:
committed by
Nathaniel Case
parent
4df53f869e
commit
5008e1d479
@@ -53,18 +53,21 @@
|
||||
net_name: '{{ test_net_name }}'
|
||||
type: appliance
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Get network id
|
||||
meraki_network:
|
||||
auth_key: '{{auth_key}}'
|
||||
state: query
|
||||
org_name: '{{test_org_name}}'
|
||||
net_name: '{{test_net_name}}'
|
||||
register: net_info
|
||||
|
||||
- set_fact:
|
||||
net_id: '{{net_info.data.id}}'
|
||||
|
||||
- name: Bind a template to a network with check mode
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
state: present
|
||||
org_name: '{{ test_org_name }}'
|
||||
net_name: '{{ test_net_name }}'
|
||||
config_template: '{{test_template_name}}'
|
||||
check_mode: yes
|
||||
register: bind_check
|
||||
|
||||
- name: Bind a template to a network
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
@@ -78,6 +81,10 @@
|
||||
that:
|
||||
bind.changed == True
|
||||
|
||||
- assert:
|
||||
that:
|
||||
bind_check is changed
|
||||
|
||||
- name: Bind a template to a network when it's already bound
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
@@ -145,7 +152,21 @@
|
||||
- bind_id_idempotent.changed == False
|
||||
- bind_id_idempotent.data is defined
|
||||
|
||||
- name: Unbind a template to a network via id
|
||||
- name: Unbind a template from a network via id with check mode
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
state: absent
|
||||
org_name: '{{test_org_name}}'
|
||||
net_id: '{{net_id}}'
|
||||
config_template: '{{test_template_name}}'
|
||||
check_mode: yes
|
||||
register: unbind_id_check
|
||||
|
||||
- assert:
|
||||
that:
|
||||
unbind_id_check is changed
|
||||
|
||||
- name: Unbind a template from a network via id
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
state: absent
|
||||
@@ -158,6 +179,29 @@
|
||||
that:
|
||||
unbind_id.changed == True
|
||||
|
||||
# This is disabled by default since they can't be created via API
|
||||
- name: Delete sacrificial template with check mode
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
state: absent
|
||||
org_name: '{{test_org_name}}'
|
||||
config_template: sacrificial_template
|
||||
check_mode: yes
|
||||
register: delete_template_check
|
||||
|
||||
# This is disabled by default since they can't be created via API
|
||||
- name: Delete sacrificial template
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
state: absent
|
||||
org_name: '{{test_org_name}}'
|
||||
config_template: sacrificial_template
|
||||
output_level: debug
|
||||
register: delete_template
|
||||
|
||||
- debug:
|
||||
var: delete_template
|
||||
|
||||
always:
|
||||
- name: Delete network
|
||||
meraki_network:
|
||||
@@ -165,4 +209,4 @@
|
||||
state: absent
|
||||
org_name: '{{ test_org_name }}'
|
||||
net_name: '{{ test_net_name }}'
|
||||
delegate_to: localhost
|
||||
delegate_to: localhost
|
||||
|
||||
Reference in New Issue
Block a user