mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-08 22:30:04 -07:00
New module - meraki_config_template (#41633)
* Implement configuration template management - Queries or removes templates - Can bind or unbind templates to networks - Module is idempotent only for binding and unbinding - Meraki does not allow template creation via API - Integration test is tedious b/c previous bullet point - Fixed bug in construct_path() so it won't set self.function * PEP8 changes * Re-enable some integration tests, use variables, and fix broken code
This commit is contained in:
parent
618c3c508f
commit
b8c39a0875
4 changed files with 346 additions and 1 deletions
1
test/integration/targets/meraki_config_template/aliases
Normal file
1
test/integration/targets/meraki_config_template/aliases
Normal file
|
@ -0,0 +1 @@
|
|||
unsupported
|
104
test/integration/targets/meraki_config_template/tasks/main.yml
Normal file
104
test/integration/targets/meraki_config_template/tasks/main.yml
Normal file
|
@ -0,0 +1,104 @@
|
|||
# Test code for the Meraki Organization module
|
||||
# Copyright: (c) 2018, Kevin Breit (@kbreit)
|
||||
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
# - name: Test an API key is provided
|
||||
# fail:
|
||||
# msg: Please define an API key
|
||||
# when: auth_key is not defined
|
||||
|
||||
# - name: Use an invalid domain
|
||||
# meraki_config_template:
|
||||
# auth_key: '{{ auth_key }}'
|
||||
# host: marrrraki.com
|
||||
# state: query
|
||||
# org_name: DevTestOrg
|
||||
# output_level: debug
|
||||
# delegate_to: localhost
|
||||
# register: invalid_domain
|
||||
# ignore_errors: yes
|
||||
|
||||
# - name: Connection assertions
|
||||
# assert:
|
||||
# that:
|
||||
# - '"Failed to connect to" in invalid_domain.msg'
|
||||
|
||||
- name: Query all configuration templates
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
state: query
|
||||
org_name: DevTestOrg
|
||||
register: get_all
|
||||
|
||||
- name: Delete non-existant configuration template
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
state: absent
|
||||
org_name: DevTestOrg
|
||||
config_template: DevConfigTemplateInvalid
|
||||
register: deleted
|
||||
ignore_errors: yes
|
||||
|
||||
- debug:
|
||||
msg: '{{deleted}}'
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- '"No configuration template named" in deleted.msg'
|
||||
|
||||
- name: Bind a template to a network
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
state: present
|
||||
org_name: '{{ test_org_name }}'
|
||||
net_name: '{{ test_net_name }}'
|
||||
config_template: DevConfigTemplate
|
||||
register: bind
|
||||
|
||||
- assert:
|
||||
that:
|
||||
bind.changed == True
|
||||
|
||||
- name: Bind a template to a network when it's already bound
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
state: present
|
||||
org_name: '{{ test_org_name }}'
|
||||
net_name: '{{ test_net_name }}'
|
||||
config_template: DevConfigTemplate
|
||||
register: bind_invalid
|
||||
ignore_errors: yes
|
||||
|
||||
- debug:
|
||||
msg: '{{bind_invalid}}'
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- bind_invalid.changed == False
|
||||
|
||||
- name: Unbind a template from a network
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
state: absent
|
||||
org_name: '{{ test_org_name }}'
|
||||
net_name: '{{ test_net_name }}'
|
||||
config_template: DevConfigTemplate
|
||||
register: unbind
|
||||
|
||||
- assert:
|
||||
that:
|
||||
unbind.changed == True
|
||||
|
||||
- name: Unbind a template from a network when it's not bound
|
||||
meraki_config_template:
|
||||
auth_key: '{{auth_key}}'
|
||||
state: absent
|
||||
org_name: '{{ test_org_name }}'
|
||||
net_name: '{{ test_net_name }}'
|
||||
config_template: DevConfigTemplate
|
||||
register: unbind_invalid
|
||||
|
||||
- assert:
|
||||
that:
|
||||
unbind_invalid.changed == False
|
Loading…
Add table
Add a link
Reference in a new issue