@ -3,280 +3,278 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# 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
- block:
fail:
- name : Test an API key is provided
msg : Please define an API key
fail:
when : auth_key is not defined
msg : Please define an API key
when : auth_key is not defined
- name : Use an invalid domain
meraki_organization:
# - name: Use an invalid domain
auth_key : '{{ auth_key }}'
# meraki_organization:
host : marrrraki.com
# auth_key: '{{ auth_key }}'
state : present
# host: marrrraki.com
org_name : IntTestOrg
# state: present
output_level : debug
# org_name: IntTestOrg
delegate_to : localhost
# output_level: debug
register : invalid_domain
# delegate_to: localhost
ignore_errors : yes
# register: invalid_domain
# ignore_errors: yes
- name : Disable HTTP
meraki_organization:
- name : Disable HTTP
auth_key : '{{ auth_key }}'
meraki_organization:
use_https : false
auth_key : '{{ auth_key }}'
state : query
use_https : false
output_level : debug
state : query
delegate_to : localhost
output_level : debug
register : http
delegate_to : localhost
ignore_errors : yes
register : http
ignore_errors : yes
- name : Connection assertions
assert:
- name : Connection assertions
that:
assert:
- '"Failed to connect to" in invalid_domain.msg'
that:
- '"http" in http.url'
# - '"Failed to connect to" in invalid_domain.msg'
- '"http" in http.url'
- name : Create test network
meraki_network:
- name : Create test network
auth_key : '{{auth_key}}'
meraki_network:
state : present
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : present
net_name : TestNetSSID
org_name : '{{test_org_name}}'
type : wireless
net_name : TestNetSSID
register : test_net
type : wireless
register : test_net
- debug :
msg : '{{test_net}}'
- debug :
msg : '{{test_net}}'
- name : Query all SSIDs
meraki_ssid:
- name : Query all SSIDs
auth_key : '{{auth_key}}'
meraki_ssid:
state : query
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : query
net_name : TestNetSSID
org_name : '{{test_org_name}}'
delegate_to : localhost
net_name : TestNetSSID
register : query_all
delegate_to : localhost
register : query_all
- debug:
msg : '{{query_all}}'
- name : Enable and name SSID
meraki_ssid:
- name : Enable and name SSID
auth_key : '{{auth_key}}'
meraki_ssid:
state : present
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : present
net_name : TestNetSSID
org_name : '{{test_org_name}}'
name : AnsibleSSID
net_name : TestNetSSID
enabled : true
name : AnsibleSSID
delegate_to : localhost
enabled : true
register : enable_name_ssid
delegate_to : localhost
register : enable_name_ssid
- debug:
msg : '{{ enable_name_ssid }}'
- debug:
msg : '{{ enable_name_ssid }}'
- assert:
that:
- assert:
- query_all.data | length == 15
that:
- query_all.data.0.name == 'TestNetSSID WiFi'
- query_all.data | length == 15
- enable_name_ssid.data.name == 'AnsibleSSID'
- query_all.data.0.name == 'TestNetSSID WiFi'
- enable_name_ssid.data.name == 'AnsibleSSID'
- name : Check for idempotency
meraki_ssid:
- name : Check for idempotency
auth_key : '{{auth_key}}'
meraki_ssid:
state : present
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : present
net_name : TestNetSSID
org_name : '{{test_org_name}}'
name : AnsibleSSID
net_name : TestNetSSID
enabled : true
name : AnsibleSSID
delegate_to : localhost
enabled : true
register : enable_name_ssid_idempotent
delegate_to : localhost
register : enable_name_ssid_idempotent
- debug:
msg : '{{ enable_name_ssid_idempotent }}'
- debug:
msg : '{{ enable_name_ssid_idempotent }}'
- assert:
that:
- assert:
- enable_name_ssid_idempotent.changed == False
that:
- enable_name_ssid_idempotent.changed == False
- name : Query one SSIDs
meraki_ssid:
- name : Query one SSIDs
auth_key : '{{auth_key}}'
meraki_ssid:
state : query
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : query
net_name : TestNetSSID
org_name : '{{test_org_name}}'
name : AnsibleSSID
net_name : TestNetSSID
delegate_to : localhost
name : AnsibleSSID
register : query_one
delegate_to : localhost
register : query_one
- debug:
msg : '{{query_one}}'
- debug:
msg : '{{query_one}}'
- assert:
that:
- assert:
- query_one.data.name == 'AnsibleSSID'
that:
- query_one.data.name == 'AnsibleSSID'
- name : Disable SSID without specifying number
meraki_ssid:
- name : Disable SSID without specifying number
auth_key : '{{auth_key}}'
meraki_ssid:
state : present
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : present
net_name : TestNetSSID
org_name : '{{test_org_name}}'
name : AnsibleSSID
net_name : TestNetSSID
enabled : false
name : AnsibleSSID
delegate_to : localhost
enabled : false
register : disable_ssid
delegate_to : localhost
register : disable_ssid
- debug:
msg : '{{ disable_ssid.data.enabled }}'
- debug:
msg : '{{ disable_ssid.data.enabled }}'
- assert:
that:
- assert:
- disable_ssid.data.enabled == False
that:
- disable_ssid.data.enabled == False
- name : Enable SSID with number
meraki_ssid:
- name : Enable SSID with number
auth_key : '{{auth_key}}'
meraki_ssid:
state : present
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : present
net_name : TestNetSSID
org_name : '{{test_org_name}}'
number : 1
net_name : TestNetSSID
enabled : true
number : 1
delegate_to : localhost
enabled : true
register : enable_ssid_number
delegate_to : localhost
register : enable_ssid_number
- debug :
msg : '{{ enable_ssid_number.data.enabled }}'
- debug :
msg : '{{ enable_ssid_number.data.enabled }}'
- assert:
that:
- assert:
- enable_ssid_number.data.enabled == True
that:
- enable_ssid_number.data.enabled == True
- name : Set PSK with wrong mode
meraki_ssid:
- name : Set PSK with wrong mode
auth_key : '{{auth_key}}'
meraki_ssid:
state : present
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : present
net_name : TestNetSSID
org_name : '{{test_org_name}}'
name : AnsibleSSID
net_name : TestNetSSID
auth_mode : open
name : AnsibleSSID
psk : abc1234
auth_mode : open
delegate_to : localhost
psk : abc1234
register : psk_invalid
delegate_to : localhost
ignore_errors : yes
register : psk_invalid
ignore_errors : yes
- debug:
msg : '{{ psk_invalid }}'
- debug:
msg : '{{ psk_invalid }}'
- assert:
that:
- assert:
- psk_invalid.msg == 'PSK is only allowed when auth_mode is set to psk'
that:
- psk_invalid.msg == 'PSK is only allowed when auth_mode is set to psk'
- name : Set PSK with invalid encryption mode
meraki_ssid:
- name : Set PSK with invalid encryption mode
auth_key : '{{auth_key}}'
meraki_ssid:
state : present
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : present
net_name : TestNetSSID
org_name : '{{test_org_name}}'
name : AnsibleSSID
net_name : TestNetSSID
auth_mode : psk
name : AnsibleSSID
psk : abc1234
auth_mode : psk
encryption_mode : eap
psk : abc1234
delegate_to : localhost
encryption_mode : eap
register : psk_invalid_mode
delegate_to : localhost
ignore_errors : yes
register : psk_invalid_mode
ignore_errors : yes
- debug:
msg : '{{ psk_invalid_mode }}'
- debug:
msg : '{{ psk_invalid_mode }}'
- assert:
that:
- assert:
- psk_invalid_mode.msg == 'PSK requires encryption_mode be set to wpa'
that:
- psk_invalid_mode.msg == 'PSK requires encryption_mode be set to wpa'
- name : Set PSK
meraki_ssid:
- name : Set PSK
auth_key : '{{auth_key}}'
meraki_ssid:
state : present
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : present
net_name : TestNetSSID
org_name : '{{test_org_name}}'
name : AnsibleSSID
net_name : TestNetSSID
auth_mode : psk
name : AnsibleSSID
psk : abc1234567890
auth_mode : psk
encryption_mode : wpa
psk : abc1234567890
delegate_to : localhost
encryption_mode : wpa
register : psk
delegate_to : localhost
register : psk
- debug:
msg : '{{ psk }}'
- debug:
msg : '{{ psk }}'
- assert:
that:
- assert:
- psk.data.authMode == 'psk'
that:
- psk.data.encryptionMode == 'wpa'
- psk.data.authMode == 'psk'
- psk.data.wpaEncryptionMode == 'WPA2 only'
- psk.data.encryptionMode == 'wpa'
- psk.data.wpaEncryptionMode == 'WPA2 only'
- name : Enable click-through splash page
meraki_ssid:
- name : Enable click-through splash page
auth_key : '{{auth_key}}'
meraki_ssid:
state : present
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : present
net_name : TestNetSSID
org_name : '{{test_org_name}}'
name : AnsibleSSID
net_name : TestNetSSID
splash_page : Click-through splash page
name : AnsibleSSID
delegate_to : localhost
splash_page : Click-through splash page
register : splash_click
delegate_to : localhost
register : splash_click
- debug:
msg : '{{ splash_click }}'
- debug:
msg : '{{ splash_click }}'
- assert:
that:
- assert:
- splash_click.data.splashPage == 'Click-through splash page'
that:
- splash_click.data.splashPage == 'Click-through splash page'
- name : Configure RADIUS servers
meraki_ssid:
- name : Configure RADIUS servers
auth_key : '{{auth_key}}'
meraki_ssid:
state : present
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : present
net_name : TestNetSSID
org_name : '{{test_org_name}}'
name : AnsibleSSID
net_name : TestNetSSID
auth_mode : open-with-radius
name : AnsibleSSID
radius_servers:
auth_mode : open-with-radius
- host : 192.0 .1 .200
radius_servers:
port : 1234
- host : 192.0 .1 .200
secret : abc98765
port : 1234
delegate_to : localhost
secret : abc98765
register : set_radius_server
delegate_to : localhost
register : set_radius_server
- debug:
msg : '{{ set_radius_server }}'
- debug:
msg : '{{ set_radius_server }}'
- assert:
that:
- assert:
- set_radius_server.data.radiusServers.0.host == '192.0.1.200'
that:
always:
- set_radius_server.data.radiusServers.0.host == '192.0.1.200'
- name : Delete SSID
meraki_ssid:
- name : Delete SSID
auth_key : '{{auth_key}}'
meraki_ssid:
state : absent
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : absent
net_name : TestNetSSID
org_name : '{{test_org_name}}'
name : AnsibleSSID
net_name : TestNetSSID
delegate_to : localhost
name : AnsibleSSID
register : delete_ssid
delegate_to : localhost
register : delete_ssid
- debug:
msg : '{{ delete_ssid }}'
- debug:
msg : '{{ delete_ssid }}'
- assert:
that:
- assert:
- delete_ssid.data.name == 'Unconfigured SSID 2'
that:
- delete_ssid.data.name == 'Unconfigured SSID 2'
- name : Delete test network
meraki_network:
- name : Delete test network
auth_key : '{{auth_key}}'
meraki_network:
state : absent
auth_key : '{{auth_key}}'
org_name : '{{test_org_name}}'
state : absent
net_name : TestNetSSID
org_name : '{{test_org_name}}'
register : delete_net
net_name : TestNetSSID
register : delete_net
- debug :
msg : '{{delete_net}}'
- debug :
msg : '{{delete_net}}'