summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/meraki/tests/integration
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:22 +0000
commit38b7c80217c4e72b1d8988eb1e60bb6e77334114 (patch)
tree356e9fd3762877d07cde52d21e77070aeff7e789 /ansible_collections/cisco/meraki/tests/integration
parentAdding upstream version 7.7.0+dfsg. (diff)
downloadansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.tar.xz
ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.zip
Adding upstream version 9.4.0+dfsg.upstream/9.4.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/cisco/meraki/tests/integration')
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/inventory.networking42
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/inventory.networking.template37
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/target-prefixes.network1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_action_batch/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_admin/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_alert/aliases0
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_config_template/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_device/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_firewalled_services/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_management_interface/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_l3_firewall/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_l7_firewall/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_radio/aliases0
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_rf_profile/aliases0
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_settings/aliases0
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_access_list/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_link_aggregation/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_stack/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_storm_control/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_switchport/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_switchport/tasks/main.yml47
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_content_filtering/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_intrusion_prevention/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l3_firewall/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l3_firewall/tasks/main.yml747
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l7_firewall/aliases2
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_malware/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_nat/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_network_vlan_settings/aliases0
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_firewall/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_firewall/tasks/main.yml665
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_vpn/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_static_route/meraki_static_route/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_third_party_vpn_peers/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_uplink_bandwidth/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_vlan/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_network/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_network_settings/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/tasks/main.yml4
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/tasks/tests.yml277
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_snmp/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_snmp/tasks/main.yml554
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_ssid/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_syslog/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_syslog/tasks/main.yml439
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/aliases1
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/tasks/main.yml3
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/tasks/tests.yml42
-rw-r--r--ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook_payload_template/aliases2
50 files changed, 1473 insertions, 1420 deletions
diff --git a/ansible_collections/cisco/meraki/tests/integration/inventory.networking b/ansible_collections/cisco/meraki/tests/integration/inventory.networking
deleted file mode 100644
index ab8958954..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/inventory.networking
+++ /dev/null
@@ -1,42 +0,0 @@
-# This is the configuration template for ansible-test network-integration tests.
-#
-# You do not need this template if you are:
-#
-# 1) Running integration tests without using ansible-test.
-# 2) Using the `--platform` option to provision temporary network instances on EC2.
-#
-# If you do not want to use the automatically provisioned temporary network instances,
-# fill in the @VAR placeholders below and save this file without the .template extension.
-#
-# NOTE: Automatic provisioning of network instances on EC2 requires an ansible-core-ci API key.
-
-[meraki]
-localhost ansible_connection="local"
-
-[meraki:vars]
-auth_key=b4aa1133085792857ae08a22ed01bc99b7e9c97d
-test_org_id=133277
-test_org_name=kbreit@insight.com
-test_net_name=Home - Appliance
-test_net_id=N_624874448297678702
-test_switch_net_name=Home - Switch
-test_wireless_net_name=Home - Wireless
-test_appliance_net_name=Home - Appliance
-test_template_name=AnsibleTemplate
-test_template_id=L_624874448297661409
-email_prefix=meraki
-email_domain=kevinbreit.net
-serial=Q2BN-MCH8-VEL5
-serial_switch=Q2HP-2C6E-GTLD
-serial_wireless=Q2KD-83UG-JL8X
-serial_switch_l3=QBSB-VLNE-E299
-serial_appliance=Q2BN-MCH8-VEL5
-# serial=QBSC-HJSL-A64F
-# serial=Q2HD-DPPR-QTAE
-# serial=Q2HP-2C6E-GTLD
-
-###
-# Example
-#
-# [vyos]
-# vyos01.example.net ansible_connection=local ansible_network_os="vyos" ansible_user=admin ansible_ssh_pass=mypassword
diff --git a/ansible_collections/cisco/meraki/tests/integration/inventory.networking.template b/ansible_collections/cisco/meraki/tests/integration/inventory.networking.template
deleted file mode 100644
index 3057b7f2f..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/inventory.networking.template
+++ /dev/null
@@ -1,37 +0,0 @@
-# This is the configuration template for ansible-test network-integration tests.
-#
-# You do not need this template if you are:
-#
-# 1) Running integration tests without using ansible-test.
-# 2) Using the `--platform` option to provision temporary network instances on EC2.
-#
-# If you do not want to use the automatically provisioned temporary network instances,
-# fill in the @VAR placeholders below and save this file without the .template extension.
-#
-# NOTE: Automatic provisioning of network instances on EC2 requires an ansible-core-ci API key.
-
-[meraki]
-localhost ansible_connection="local"
-
-[meraki:vars]
-auth_key=abc1234567890
-test_org_id=12345
-test_org_name=YourOrg
-test_net_name=YourNet
-test_net_id=54321
-test_switch_net_name=Switch Net
-test_wireless_net_name=Wireless Net
-test_template_name=YourTemplate
-test_template_id=L_12345
-email_prefix=YourEmail
-email_domain=YourDomain
-serial=YourSerial
-serial_switch=YourSwitchSerial
-serial_switch_l3=YourL3SwitchSerial
-
-
-###
-# Example
-#
-# [vyos]
-# vyos01.example.net ansible_connection=local ansible_network_os="vyos" ansible_user=admin ansible_ssh_pass=mypassword
diff --git a/ansible_collections/cisco/meraki/tests/integration/target-prefixes.network b/ansible_collections/cisco/meraki/tests/integration/target-prefixes.network
deleted file mode 100644
index 2516cd48f..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/target-prefixes.network
+++ /dev/null
@@ -1 +0,0 @@
-meraki
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_action_batch/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_action_batch/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_action_batch/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_admin/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_admin/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_admin/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_alert/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_alert/aliases
deleted file mode 100644
index e69de29bb..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_alert/aliases
+++ /dev/null
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_config_template/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_config_template/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_config_template/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_device/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_device/aliases
deleted file mode 100644
index 89aea537d..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_device/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported \ No newline at end of file
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_firewalled_services/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_firewalled_services/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_firewalled_services/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_management_interface/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_management_interface/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_management_interface/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_l3_firewall/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_l3_firewall/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_l3_firewall/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_l7_firewall/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_l7_firewall/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_l7_firewall/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_radio/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_radio/aliases
deleted file mode 100644
index e69de29bb..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_radio/aliases
+++ /dev/null
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_rf_profile/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_rf_profile/aliases
deleted file mode 100644
index e69de29bb..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_rf_profile/aliases
+++ /dev/null
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_settings/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_settings/aliases
deleted file mode 100644
index e69de29bb..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mr_settings/aliases
+++ /dev/null
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_access_list/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_access_list/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_access_list/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_link_aggregation/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_link_aggregation/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_link_aggregation/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_stack/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_stack/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_stack/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_storm_control/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_storm_control/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_storm_control/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_switchport/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_switchport/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_switchport/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_switchport/tasks/main.yml b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_switchport/tasks/main.yml
index 3ebd43ec3..1ad1f2d6f 100644
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_switchport/tasks/main.yml
+++ b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ms_switchport/tasks/main.yml
@@ -780,3 +780,50 @@
that:
- idempotent_delete_mac.changed == False
- idempotent_delete_mac.data is defined
+
+- name: Change the switchport to 1 GB to auto
+ cisco.meraki.meraki_ms_switchport:
+ auth_key: "{{ auth_key }}"
+ link_negotiation: "Auto negotiate"
+ number: 9
+ serial: "{{ serial_switch }}"
+ state: present
+ register: forced_change_port
+
+- name: Change the switchport to 1 GB forced
+ cisco.meraki.meraki_ms_switchport:
+ auth_key: "{{ auth_key }}"
+ link_negotiation: "1 Gigabit full duplex (forced)"
+ number: 9
+ serial: "{{ serial_switch }}"
+ state: present
+ register: forced_change_port
+
+- name: Debug forced_change_port
+ ansible.builtin.debug:
+ msg: "{{ forced_change_port }}"
+
+- name: Assert the port forced port
+ ansible.builtin.assert:
+ that:
+ - forced_change_port.changed == True
+ - forced_change_port.data.link_negotiation == "1 Gigabit full duplex (forced)"
+
+- name: Change the switchport to 1 GB auto
+ cisco.meraki.meraki_ms_switchport:
+ auth_key: "{{ auth_key }}"
+ link_negotiation: "1 Gigabit full duplex (auto)"
+ number: 9
+ serial: "{{ serial_switch }}"
+ state: present
+ register: auto_change_port
+
+- name: Debug auto_change_port
+ ansible.builtin.debug:
+ msg: "{{ auto_change_port }}"
+
+- name: Assert the port auto port
+ ansible.builtin.assert:
+ that:
+ - auto_change_port.changed == True
+ - auto_change_port.data.link_negotiation == "1 Gigabit full duplex (auto)"
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_content_filtering/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_content_filtering/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_content_filtering/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_intrusion_prevention/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_intrusion_prevention/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_intrusion_prevention/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l3_firewall/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l3_firewall/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l3_firewall/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l3_firewall/tasks/main.yml b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l3_firewall/tasks/main.yml
index c8dbd1718..fb97e47be 100644
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l3_firewall/tasks/main.yml
+++ b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l3_firewall/tasks/main.yml
@@ -3,367 +3,390 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
-- block:
- - name: Test an API key is provided
- fail:
- msg: Please define an API key
- when: auth_key is not defined
-
- - name: Create network
- meraki_network:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- type: appliance
- delegate_to: localhost
-
- - name: Query firewall rules
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: query
- delegate_to: localhost
- register: query
-
- - assert:
- that:
- - query.data|length == 1
-
- - name: Check rule values are lowercase
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: query
- delegate_to: localhost
- register: query
-
- - assert:
- that:
- - query.data.rules.0.policy == 'allow'
- - query.data.rules.0.protocol == 'any'
- - query.data.rules.0.src_port == 'any'
- - query.data.rules.0.src_cidr == 'any'
- - query.data.rules.0.dest_port == 'any'
- - query.data.rules.0.dest_cidr == 'any'
-
- - name: Set one firewall rule with check mode
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32
- protocol: tcp
- policy: deny
- delegate_to: localhost
- check_mode: yes
- register: create_one_check
-
- - debug:
- var: create_one_check
-
- - assert:
- that:
- - create_one_check.data|length == 2
- - create_one_check.data.0.dest_cidr == '192.0.1.1/32'
- - create_one_check.data.0.protocol == 'tcp'
- - create_one_check.data.0.policy == 'deny'
- - create_one_check is changed
- - create_one_check.data is defined
-
- - name: Set one firewall rule
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_id: '{{test_org_id}}'
- net_name: TestNetAppliance
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32
- protocol: tcp
- policy: deny
- delegate_to: localhost
- register: create_one
-
- - debug:
- var: create_one
-
- - assert:
- that:
- - create_one.data.rules|length == 2
- - create_one.data.rules.0.dest_cidr == '192.0.1.1/32'
- - create_one.data.rules.0.protocol == 'tcp'
- - create_one.data.rules.0.policy == 'deny'
- - create_one.changed == True
- - create_one.data is defined
-
- - name: Check for idempotency
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32
- protocol: tcp
- policy: deny
- delegate_to: localhost
- register: create_one_idempotent
-
- - debug:
- msg: '{{create_one_idempotent}}'
-
- - assert:
- that:
- - create_one_idempotent.changed == False
- - create_one_idempotent.data is defined
-
- - name: Update one existing rule
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- rules:
- - comment: Deny all documentation addresses
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32,192.0.1.2/32
- protocol: tcp
- policy: deny
- delegate_to: localhost
- register: update_one
-
- - debug:
- msg: '{{update_one}}'
-
- - assert:
- that:
- - update_one.changed == True
- - update_one.data is defined
-
- - name: Create syslog in network
- meraki_syslog:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- servers:
- - host: 192.0.2.10
- port: 514
- roles:
- - Appliance event log
- - Flows
- delegate_to: localhost
-
- - name: Enable syslog for default rule with check mode
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32
- protocol: tcp
- policy: deny
- syslog_default_rule: yes
- delegate_to: localhost
- check_mode: yes
- register: default_syslog_check
-
- - debug:
- msg: '{{default_syslog_check}}'
-
- - assert:
- that:
- - default_syslog_check.data is defined
- - default_syslog_check.data.1.syslog_enabled == True
-
-
- - name: Enable syslog for default rule
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32
- protocol: tcp
- policy: deny
- syslog_default_rule: yes
- delegate_to: localhost
- register: default_syslog
-
- - debug:
- msg: '{{default_syslog}}'
-
- - assert:
- that:
- - default_syslog.data is defined
-
- - name: Set protocol to any for idempotency check
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: any
- src_cidr: any
- dest_port: any
- dest_cidr: 192.0.1.1/32
- protocol: any
- policy: deny
- delegate_to: localhost
-
- - name: Check for protocol any idempotency
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: any
- src_cidr: any
- dest_port: any
- dest_cidr: 192.0.1.1/32
- protocol: any
- policy: deny
- delegate_to: localhost
- register: any_idempotency
-
- - assert:
- that:
- - any_idempotency is not changed
-
- - name: Query firewall rules
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: query
- delegate_to: localhost
- register: query
-
- - assert:
- that:
- - query.data.rules.1.syslog_enabled == True
- - default_syslog.changed == True
-
- - name: Disable syslog for default rule
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32
- protocol: tcp
- policy: deny
- syslog_default_rule: no
- delegate_to: localhost
- register: disable_syslog
-
- - debug:
- msg: '{{disable_syslog}}'
-
- - assert:
- that:
- - disable_syslog.data is defined
-
- - name: Query firewall rules
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: query
- delegate_to: localhost
- register: query
-
- - debug:
- msg: '{{query}}'
-
- - name: Enable syslog for default rule with no rules and with check mode
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- syslog_default_rule: yes
- delegate_to: localhost
- check_mode: yes
- register: enable_syslog_only_check
-
- - debug:
- msg: '{{enable_syslog_only_check}}'
-
- - assert:
- that:
- - enable_syslog_only_check.data.rules.1.syslog_enabled == True
- - enable_syslog_only_check is changed
-
- - name: Query firewall rules
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: query
- delegate_to: localhost
- register: query
-
- - debug:
- msg: '{{query.data.rules.1}}'
-
- - assert:
- that:
- - query.data.rules.1.syslog_enabled == False
- - disable_syslog.changed == True
+- name: Block of tasks
+ block:
+ - name: Test an API key is provided
+ ansible.builtin.fail:
+ msg: Please define an API key
+ when: auth_key is not defined
+
+ - name: Create network
+ cisco.meraki.meraki_network:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: present
+ type: appliance
+ delegate_to: localhost
+
+ - name: Query firewall rules
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: query
+ delegate_to: localhost
+ register: query
+
+ - name: Assert query.data
+ ansible.builtin.assert:
+ that:
+ - query.data|length == 1
+
+ - name: Check rule values are lowercase
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: query
+ delegate_to: localhost
+ register: query
+
+ - name: Assert query.data.rules
+ ansible.builtin.assert:
+ that:
+ - query.data.rules.0.policy == 'allow'
+ - query.data.rules.0.protocol == 'any'
+ - query.data.rules.0.src_port == 'any'
+ - query.data.rules.0.src_cidr == 'any'
+ - query.data.rules.0.dest_port == 'any'
+ - query.data.rules.0.dest_cidr == 'any'
+
+ - name: Set one firewall rule with check mode
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32
+ protocol: tcp
+ policy: deny
+ delegate_to: localhost
+ check_mode: true
+ register: create_one_check
+
+ - name: Debug create_one_check
+ ansible.builtin.debug:
+ var: create_one_check
+
+ - name: Assert create_one_check
+ ansible.builtin.assert:
+ that:
+ - create_one_check.data|length == 2
+ - create_one_check.data.0.dest_cidr == '192.0.1.1/32'
+ - create_one_check.data.0.protocol == 'tcp'
+ - create_one_check.data.0.policy == 'deny'
+ - create_one_check is changed
+ - create_one_check.data is defined
+
+ - name: Set one firewall rule
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_id: "{{ test_org_id }}"
+ net_name: TestNetAppliance
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32
+ protocol: tcp
+ policy: deny
+ delegate_to: localhost
+ register: create_one
+
+ - name: Debug create_one
+ ansible.builtin.debug:
+ var: create_one
+
+ - name: Assert create_one
+ ansible.builtin.assert:
+ that:
+ - create_one.data.rules|length == 2
+ - create_one.data.rules.0.dest_cidr == '192.0.1.1/32'
+ - create_one.data.rules.0.protocol == 'tcp'
+ - create_one.data.rules.0.policy == 'deny'
+ - create_one.changed == True
+ - create_one.data is defined
+
+ - name: Check for idempotency
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32
+ protocol: tcp
+ policy: deny
+ delegate_to: localhost
+ register: create_one_idempotent
+
+ - name: Debug create_one_idempotent
+ ansible.builtin.debug:
+ msg: "{{ create_one_idempotent }}"
+
+ - name: Assert create_one_idempotent
+ ansible.builtin.assert:
+ that:
+ - create_one_idempotent.changed == False
+ - create_one_idempotent.data is defined
+
+ - name: Update one existing rule
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: present
+ rules:
+ - comment: Deny all documentation addresses
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32,192.0.1.2/32
+ protocol: tcp
+ policy: deny
+ delegate_to: localhost
+ register: update_one
+
+ - name: Debug update_one
+ ansible.builtin.debug:
+ msg: "{{ update_one }}"
+
+ - name: Assert update_one
+ ansible.builtin.assert:
+ that:
+ - update_one.changed == True
+ - update_one.data is defined
+
+ - name: Create syslog in network
+ cisco.meraki.meraki_syslog:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: present
+ servers:
+ - host: 192.0.2.10
+ port: 514
+ roles:
+ - Appliance event log
+ - Flows
+ delegate_to: localhost
+
+ - name: Enable syslog for default rule with check mode
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32
+ protocol: tcp
+ policy: deny
+ syslog_default_rule: true
+ delegate_to: localhost
+ check_mode: true
+ register: default_syslog_check
+
+ - name: Debug default_syslog_check
+ ansible.builtin.debug:
+ msg: "{{ default_syslog_check }}"
+
+ - name: Assert default_syslog_check
+ ansible.builtin.assert:
+ that:
+ - default_syslog_check.data is defined
+ - default_syslog_check.data.1.syslog_enabled == True
+
+ - name: Enable syslog for default rule
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32
+ protocol: tcp
+ policy: deny
+ syslog_default_rule: true
+ delegate_to: localhost
+ register: default_syslog
+
+ - name: Debug default_syslog
+ ansible.builtin.debug:
+ msg: "{{ default_syslog }}"
+
+ - name: Assert default_syslog.data
+ ansible.builtin.assert:
+ that:
+ - default_syslog.data is defined
+
+ - name: Set protocol to any for idempotency check
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: any
+ src_cidr: any
+ dest_port: any
+ dest_cidr: 192.0.1.1/32
+ protocol: any
+ policy: deny
+ delegate_to: localhost
+
+ - name: Check for protocol any idempotency
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: any
+ src_cidr: any
+ dest_port: any
+ dest_cidr: 192.0.1.1/32
+ protocol: any
+ policy: deny
+ delegate_to: localhost
+ register: any_idempotency
+
+ - name: Assert any_idempotency
+ ansible.builtin.assert:
+ that:
+ - any_idempotency is not changed
+
+ - name: Query firewall rules
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: query
+ delegate_to: localhost
+ register: query
+
+ - name: Assert query.data and default_syslog.changed
+ ansible.builtin.assert:
+ that:
+ - query.data.rules.1.syslog_enabled == True
+ - default_syslog.changed == True
+
+ - name: Disable syslog for default rule
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32
+ protocol: tcp
+ policy: deny
+ syslog_default_rule: false
+ delegate_to: localhost
+ register: disable_syslog
+
+ - name: Debug disable_syslog
+ ansible.builtin.debug:
+ msg: "{{ disable_syslog }}"
+
+ - name: Assert disable_syslog
+ ansible.builtin.assert:
+ that:
+ - disable_syslog.data is defined
+
+ - name: Query firewall rules
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: query
+ delegate_to: localhost
+ register: query
+
+ - name: Debug query
+ ansible.builtin.debug:
+ msg: "{{ query }}"
+
+ - name: Enable syslog for default rule with no rules and with check mode
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: present
+ syslog_default_rule: true
+ delegate_to: localhost
+ check_mode: true
+ register: enable_syslog_only_check
+
+ - name: Debug enable_syslog_only_check
+ ansible.builtin.debug:
+ msg: "{{ enable_syslog_only_check }}"
+
+ - name: Assert enable_syslog_only_check
+ ansible.builtin.assert:
+ that:
+ - enable_syslog_only_check.data.rules.1.syslog_enabled == True
+ - enable_syslog_only_check is changed
+
+ - name: Query firewall rules
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: query
+ delegate_to: localhost
+ register: query
+
+ - name: Debug query.data.rules.1
+ ansible.builtin.debug:
+ msg: "{{query.data.rules.1}}"
+
+ - name: Assert query.data and disable_syslog
+ ansible.builtin.assert:
+ that:
+ - query.data.rules.1.syslog_enabled == False
+ - disable_syslog.changed == True
always:
- - name: Delete all firewall rules
- meraki_mx_l3_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- rules: []
- delegate_to: localhost
- register: delete_all
-
- - name: Delete network
- meraki_network:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: absent
- delegate_to: localhost
+ - name: Delete all firewall rules
+ cisco.meraki.meraki_mx_l3_firewall:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: present
+ rules: []
+ delegate_to: localhost
+ register: delete_all
+
+ - name: Delete network
+ cisco.meraki.meraki_network:
+ auth_key: "{{ auth_key }}"
+ org_name: "{{ test_org_name }}"
+ net_name: TestNetAppliance
+ state: absent
+ delegate_to: localhost
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l7_firewall/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l7_firewall/aliases
deleted file mode 100644
index 06fe32bc6..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_l7_firewall/aliases
+++ /dev/null
@@ -1,2 +0,0 @@
-unsupported
-
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_malware/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_malware/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_malware/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_nat/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_nat/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_nat/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_network_vlan_settings/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_network_vlan_settings/aliases
deleted file mode 100644
index e69de29bb..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_network_vlan_settings/aliases
+++ /dev/null
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_firewall/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_firewall/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_firewall/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_firewall/tasks/main.yml b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_firewall/tasks/main.yml
index df0b91644..eedbc4ff4 100644
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_firewall/tasks/main.yml
+++ b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_firewall/tasks/main.yml
@@ -3,304 +3,371 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
-- block:
- - name: Test an API key is provided
- fail:
- msg: Please define an API key
- when: auth_key is not defined
-
- - name: Create network
- meraki_network:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- type: appliance
- delegate_to: localhost
-
- - name: Query firewall rules
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: query
- delegate_to: localhost
- register: query
-
- - debug:
- var: query
-
- # - assert:
- # that:
- # - query.data|length == 1
-
- - name: Set one firewall rule with check mode
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32
- protocol: tcp
- policy: deny
- delegate_to: localhost
- check_mode: yes
- register: create_one_check
-
- - debug:
- var: create_one_check
-
- - assert:
- that:
- - create_one_check.data.rules|length == 2
- - create_one_check.data.rules.0.dest_cidr == '192.0.1.1/32'
- - create_one_check.data.rules.0.protocol == 'tcp'
- - create_one_check.data.rules.0.policy == 'deny'
- - create_one_check is changed
- - create_one_check.data is defined
-
- - name: Set one firewall rule
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32
- protocol: tcp
- policy: deny
- delegate_to: localhost
- register: create_one
-
- - debug:
- var: create_one
-
- - assert:
- that:
- - create_one.data.rules|length == 2
- - create_one.data.rules.0.dest_cidr == '192.0.1.1/32'
- - create_one.data.rules.0.protocol == 'tcp'
- - create_one.data.rules.0.policy == 'deny'
- - create_one.changed == True
- - create_one.data is defined
-
- - name: Check for idempotency
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32
- protocol: tcp
- policy: deny
- delegate_to: localhost
- register: create_one_idempotent
-
- - debug:
- msg: '{{create_one_idempotent}}'
-
- - assert:
- that:
- - create_one_idempotent.changed == False
- - create_one_idempotent.data is defined
-
- - name: Update one existing rule
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: present
- rules:
- - comment: Deny all documentation addresses
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32,192.0.1.2/32
- protocol: tcp
- policy: deny
- delegate_to: localhost
- register: update_one
-
- - debug:
- msg: '{{update_one}}'
-
- - assert:
- that:
- - update_one.changed == True
- - update_one.data is defined
-
- - name: Create syslog in network
- meraki_syslog:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: present
- servers:
- - host: 192.0.2.10
- port: 514
- roles:
- - Appliance event log
- - Flows
- delegate_to: localhost
-
- - name: Enable syslog for default rule with check mode
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32
- protocol: tcp
- policy: deny
- syslog_default_rule: yes
- delegate_to: localhost
- check_mode: yes
- register: default_syslog_check
-
- - debug:
- msg: '{{default_syslog_check}}'
-
- - assert:
- that:
- - default_syslog_check.data is defined
- - default_syslog_check.data.rules.1.syslog_enabled == True
-
- - name: Enable syslog for default rule
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32
- protocol: tcp
- policy: deny
- syslog_default_rule: yes
- delegate_to: localhost
- register: default_syslog
-
- - debug:
- msg: '{{default_syslog}}'
-
- - assert:
- that:
- - default_syslog.data is defined
-
- - name: Query firewall rules
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: query
- delegate_to: localhost
- register: query
-
- - debug:
- msg: '{{query.data.rules.1}}'
-
- - assert:
- that:
- - query.data.rules.1.syslog_enabled == True
- - default_syslog.changed == True
-
- - name: Disable syslog for default rule
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: present
- rules:
- - comment: Deny to documentation address
- src_port: Any
- src_cidr: Any
- dest_port: 80,443
- dest_cidr: 192.0.1.1/32
- protocol: tcp
- policy: deny
- syslog_default_rule: no
- delegate_to: localhost
- register: disable_syslog
-
- - debug:
- msg: '{{disable_syslog}}'
-
- - assert:
- that:
- - disable_syslog.data is defined
-
- - name: Query firewall rules
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: query
- delegate_to: localhost
- register: query
-
- - debug:
- msg: '{{query}}'
-
- - name: Enable syslog for default rule with no rules and with check mode
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: present
- syslog_default_rule: yes
- delegate_to: localhost
- check_mode: yes
- register: enable_syslog_only_check
-
- - debug:
- msg: '{{enable_syslog_only_check}}'
-
- - assert:
- that:
- - enable_syslog_only_check.data.rules.1.syslog_enabled == True
- - enable_syslog_only_check is changed
-
- - name: Query firewall rules
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: query
- delegate_to: localhost
- register: query
-
- - debug:
- msg: '{{query.data.rules.1}}'
-
- - assert:
- that:
- - query.data.rules.1.syslog_enabled == False
- - disable_syslog.changed == True
+- name: Run tests against meraki_mx_site_to_site_firewall
+ block:
+ - name: Test an API key is provided
+ ansible.builtin.fail:
+ msg: Please define an API key
+ when: auth_key is not defined
+
+ - name: Create network
+ cisco.meraki.meraki_network:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: TestNetAppliance
+ state: present
+ type: appliance
+ delegate_to: localhost
+
+ - name: Test issue 302
+ cisco.meraki.meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ syslog_default_rule: true
+ rules:
+ - comment: Block All telnet Traffic Rename
+ src_cidr: 192.0.2.0/24
+ src_port: any
+ dest_cidr: 192.0.2.2/32
+ dest_port: 23, 22
+ protocol: tcp
+ policy: deny
+ syslog_enabled: true
+
+ - comment: Allow Middle Rule
+ src_cidr: 192.0.1.0/24
+ src_port: any
+ dest_cidr: 192.0.2.2/32
+ dest_port: 9443, 8080
+ protocol: tcp
+ policy: allow
+ syslog_enabled: true
+
+ - comment: Allow Web traffic
+ src_cidr: 192.0.1.0/24
+ src_port: any
+ dest_cidr: 192.0.2.2/32
+ dest_port: 80, 443, 8443
+ protocol: tcp
+ policy: allow
+ syslog_enabled: true
+ delegate_to: localhost
+ register: threeohtwo_original
+
+ - name: Assert previous task is correct
+ ansible.builtin.assert:
+ that:
+ - threeohtwo_original.data is defined
+ - threeohtwo_original.data.rules[0].comment == "Block All telnet Traffic Rename"
+ - threeohtwo_original.data.rules[1].comment == "Allow Middle Rule"
+ - threeohtwo_original.data.rules[2].comment == "Allow Web traffic"
+ - threeohtwo_original.data.rules[0].dest_cidr == "192.0.2.2/32"
+
+ - name: Update rules to test 302
+ cisco.meraki.meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ syslog_default_rule: true
+ rules:
+ - comment: Block All telnet Traffic Rename
+ src_cidr: 192.0.2.0/24
+ src_port: any
+ dest_cidr: 192.0.2.2/32, 192.0.3.0/24
+ dest_port: 23, 22
+ protocol: tcp
+ policy: deny
+ syslog_enabled: true
+
+ - comment: Allow Web traffic
+ src_cidr: 192.0.1.0/24
+ src_port: any
+ dest_cidr: 192.0.2.2/32
+ dest_port: 80, 443, 8443
+ protocol: tcp
+ policy: allow
+ syslog_enabled: true
+
+ - comment: Allow Middle Rule
+ src_cidr: 192.0.1.0/24
+ src_port: any
+ dest_cidr: 192.0.2.2/32
+ dest_port: 9443, 8080
+ protocol: tcp
+ policy: allow
+ syslog_enabled: true
+ delegate_to: localhost
+ register: threeohtwo_update
+
+ - name: Assert previous task is correct
+ ansible.builtin.assert:
+ that:
+ - threeohtwo_update.data is defined
+ - threeohtwo_update.data.rules[0].comment == "Block All telnet Traffic Rename"
+ - threeohtwo_update.data.rules[1].comment == "Allow Web traffic"
+ - threeohtwo_update.data.rules[2].comment == "Allow Middle Rule"
+ - threeohtwo_update.data.rules[0].dest_cidr == "192.0.2.2/32,192.0.3.0/24"
+
+ - name: Test capitalization for protocol
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ syslog_default_rule: true
+ rules:
+ - comment: Block All telnet Traffic Rename
+ src_cidr: 192.0.2.0/24
+ src_port: Any
+ dest_cidr: 192.0.2.2/32, 192.0.3.0/24
+ dest_port: 23, 22
+ protocol: any
+ policy: deny
+ syslog_enabled: true
+ delegate_to: localhost
+ register: protocol_any
+
+ - name: Assert previous task is correct
+ ansible.builtin.assert:
+ that:
+ - protocol_any is success
+ - protocol_any is changed
+ - protocol_any.data.rules[0].protocol == "any"
+
+ - name: Query firewall rules
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: query
+ delegate_to: localhost
+ register: query
+
+ - name: Set one firewall rule with check mode
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32
+ protocol: tcp
+ policy: deny
+ delegate_to: localhost
+ check_mode: true
+ register: create_one_check
+
+ - name: Assert previous task is correct
+ ansible.builtin.assert:
+ that:
+ - create_one_check.data.rules|length == 2
+ - create_one_check.data.rules.0.dest_cidr == '192.0.1.1/32'
+ - create_one_check.data.rules.0.protocol == 'tcp'
+ - create_one_check.data.rules.0.policy == 'deny'
+ - create_one_check is changed
+ - create_one_check.data is defined
+
+ - name: Set one firewall rule
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32
+ protocol: tcp
+ policy: deny
+ delegate_to: localhost
+ register: create_one
+
+ - name: Assert previous task is correct
+ ansible.builtin.assert:
+ that:
+ - create_one.data.rules|length == 2
+ - create_one.data.rules.0.dest_cidr == '192.0.1.1/32'
+ - create_one.data.rules.0.protocol == 'tcp'
+ - create_one.data.rules.0.policy == 'deny'
+ - create_one.changed == True
+ - create_one.data is defined
+
+ - name: Check for idempotency
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32
+ protocol: tcp
+ policy: deny
+ delegate_to: localhost
+ register: create_one_idempotent
+
+ - name: Assert previous task is correct
+ ansible.builtin.assert:
+ that:
+ - create_one_idempotent.changed == False
+ - create_one_idempotent.data is defined
+
+ - name: Update one existing rule
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ rules:
+ - comment: Deny all documentation addresses
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32,192.0.1.2/32
+ protocol: tcp
+ policy: deny
+ delegate_to: localhost
+ register: update_one
+
+
+ - name: Enable syslog for default rule with check mode
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32
+ protocol: tcp
+ policy: deny
+ syslog_default_rule: true
+ delegate_to: localhost
+ check_mode: true
+ register: default_syslog_check
+
+ - name: Assert previous task is correct
+ ansible.builtin.assert:
+ that:
+ - default_syslog_check.data is defined
+ - default_syslog_check.data.rules.1.syslog_enabled == True
+
+ - name: Enable syslog for default rule
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32
+ protocol: tcp
+ policy: deny
+ syslog_default_rule: true
+ delegate_to: localhost
+ register: default_syslog
+
+ - name: Assert previous task is correct
+ ansible.builtin.assert:
+ that:
+ - default_syslog.data is defined
+
+ - name: Query firewall rules
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: query
+ delegate_to: localhost
+ register: query
+
+ - name: Assert previous task is correct
+ ansible.builtin.assert:
+ that:
+ - query.data.rules.1.syslog_enabled == True
+ - default_syslog.changed == True
+
+ - name: Disable syslog for default rule
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ rules:
+ - comment: Deny to documentation address
+ src_port: Any
+ src_cidr: Any
+ dest_port: 80,443
+ dest_cidr: 192.0.1.1/32
+ protocol: tcp
+ policy: deny
+ syslog_default_rule: false
+ delegate_to: localhost
+ register: disable_syslog
+
+ - name: Assert previous task is correct
+ ansible.builtin.assert:
+ that:
+ - disable_syslog.data is defined
+
+ - name: Query firewall rules
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: query
+ delegate_to: localhost
+ register: query
+
+ - name: Enable syslog for default rule with no rules and with check mode
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ syslog_default_rule: true
+ delegate_to: localhost
+ check_mode: true
+ register: enable_syslog_only_check
+
+ - name: Assert previous task is correct
+ ansible.builtin.assert:
+ that:
+ - enable_syslog_only_check.data.rules.1.syslog_enabled == True
+ - enable_syslog_only_check is changed
+
+ - name: Query firewall rules
+ meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: query
+ delegate_to: localhost
+ register: query
+
+ - name: Assert previous task is correct
+ ansible.builtin.assert:
+ that:
+ - query.data.rules.1.syslog_enabled == False
+ - disable_syslog.changed == True
always:
- - name: Delete all firewall rules
- meraki_mx_site_to_site_firewall:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- state: present
- rules: []
- delegate_to: localhost
- register: delete_all
-
- - name: Delete network
- meraki_network:
- auth_key: '{{ auth_key }}'
- org_name: '{{test_org_name}}'
- net_name: TestNetAppliance
- state: absent
- delegate_to: localhost
+ - name: Delete all firewall rules
+ cisco.meraki.meraki_mx_site_to_site_firewall:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ rules: []
+ delegate_to: localhost
+ register: delete_all
+
+ - name: Delete network
+ cisco.meraki.meraki_network:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: TestNetAppliance
+ state: absent
+ delegate_to: localhost
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_vpn/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_vpn/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_site_to_site_vpn/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_static_route/meraki_static_route/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_static_route/meraki_static_route/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_static_route/meraki_static_route/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_third_party_vpn_peers/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_third_party_vpn_peers/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_third_party_vpn_peers/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_uplink_bandwidth/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_uplink_bandwidth/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_uplink_bandwidth/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_vlan/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_vlan/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_vlan/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_network/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_network/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_network/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_network_settings/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_network_settings/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_network_settings/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/tasks/main.yml b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/tasks/main.yml
index e7ad65b81..ea2323e57 100644
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/tasks/main.yml
+++ b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/tasks/main.yml
@@ -4,5 +4,5 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
- name: Run test cases
- include: tests.yml ansible_connection=local
- \ No newline at end of file
+ ansible.builtin.include_tasks:
+ file: tests.yml
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/tasks/tests.yml b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/tasks/tests.yml
index 28ebce01e..35fb9c088 100644
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/tasks/tests.yml
+++ b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_organization/tasks/tests.yml
@@ -3,147 +3,140 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
-- block:
- - name: Test an API key is provided
- fail:
- msg: Please define an API key
- when: auth_key is not defined
-
- - name: Create a new organization named IntTestOrg
- meraki_organization:
- auth_key: '{{ auth_key }}'
- org_name: IntTestOrg
- state: present
- output_level: debug
- register: new_org
-
- - debug:
- msg: '{{new_org}}'
-
- - name: Clone IntTestOrg
- meraki_organization:
- auth_key: '{{ auth_key }}'
- clone: IntTestOrg
- org_name: IntTestOrgCloned
- state: present
- register: cloned_org
-
- - debug:
- msg: '{{cloned_org}}'
-
- - set_fact:
- cloned_net_id: '{{cloned_org.data.id}}'
-
- - name: Rename IntTestOrg
- meraki_organization:
- auth_key: '{{ auth_key }}'
- org_name: IntTestOrgRenamed
- org_id: '{{ new_org.data.id }}'
- state: present
- register: modify_org
-
- - debug:
- msg: '{{ modify_org }}'
-
- - set_fact:
- renamed_org_id: '{{modify_org.data.id}}'
-
- - name: Rename IntTestOrg idempotent
- meraki_organization:
- auth_key: '{{ auth_key }}'
- org_name: IntTestOrgRenamed
- org_id: '{{ new_org.data.id }}'
- state: present
- register: modify_org_idempotent
-
- - name: Present assertions
- assert:
- that:
- - '"https" in new_org.url'
- - new_org.changed == True
- - new_org.data.id is defined
- - cloned_org.changed == True
- - cloned_org.data.id is defined
- - modify_org.changed == True
- - 'modify_org.data.name == "IntTestOrgRenamed"'
- - modify_org_idempotent.changed == False
- - modify_org_idempotent.data is defined
-
- - name: List all organizations
- meraki_organization:
- auth_key: '{{ auth_key }}'
- state: query
- register: query_all
-
- - name: Query information about a single organization named IntTestOrg
- meraki_organization:
- auth_key: '{{ auth_key }}'
- org_name: IntTestOrgRenamed
- state: query
- register: query_org
-
- - name: Query information about IntTestOrg by organization ID
- meraki_organization:
- auth_key: '{{ auth_key }}'
- org_id: '{{ query_org.data.id }}'
- state: query
- register: query_org_id
-
- - name: Query assertions
- assert:
- that:
- - query_org.data.id is defined
- - query_all.changed == False
- - query_all.data | length >= 1
- - 'query_org.data.name == "IntTestOrgRenamed"'
- - 'query_org_id.data.id == query_org.data.id'
-
- - name: Delete without confirmation code
- meraki_organization:
- auth_key: '{{ auth_key }}'
- state: absent
- org_name: IntTestOrgCloned
- register: delete_no_confirm
- ignore_errors: yes
-
- - assert:
- that:
- 'delete_no_confirm.msg == "delete_confirm must match the network ID of the network to be deleted."'
+- name: Execute tests for meraki_organiztion
+ block:
+ - name: Test an API key is provided
+ ansible.builtin.fail:
+ msg: Please define an API key
+ when: auth_key is not defined
+
+ - name: Create a new organization named IntTestOrg
+ cisco.meraki.meraki_organization:
+ auth_key: '{{ auth_key }}'
+ org_name: IntTestOrg
+ state: present
+ output_level: debug
+ register: new_org
+
+ - name: Clone IntTestOrg
+ cisco.meraki.meraki_organization:
+ auth_key: '{{ auth_key }}'
+ clone: IntTestOrg
+ org_name: IntTestOrgCloned
+ state: present
+ register: cloned_org
+
+ - name: Set cloned network ID
+ ansible.builtin.set_fact:
+ cloned_net_id: '{{ cloned_org.data.id }}'
+
+ - name: Rename IntTestOrg
+ cisco.meraki.meraki_organization:
+ auth_key: '{{ auth_key }}'
+ org_name: IntTestOrgRenamed
+ org_id: '{{ new_org.data.id }}'
+ state: present
+ register: modify_org
+
+ - name: Set renamed organization ID
+ ansible.builtin.set_fact:
+ renamed_org_id: '{{ modify_org.data.id }}'
+
+ - name: Rename IntTestOrg idempotent
+ cisco.meraki.meraki_organization:
+ auth_key: '{{ auth_key }}'
+ org_name: IntTestOrgRenamed
+ org_id: '{{ new_org.data.id }}'
+ state: present
+ register: modify_org_idempotent
+
+ - name: Present assertions
+ ansible.builtin.assert:
+ that:
+ - '"https" in new_org.url'
+ - new_org.changed == True
+ - new_org.data.id is defined
+ - cloned_org.changed == True
+ - cloned_org.data.id is defined
+ - modify_org.changed == True
+ - 'modify_org.data.name == "IntTestOrgRenamed"'
+ - modify_org_idempotent.changed == False
+ - modify_org_idempotent.data is defined
+
+ - name: List all organizations
+ cisco.meraki.meraki_organization:
+ auth_key: '{{ auth_key }}'
+ state: query
+ register: query_all
+
+ - name: Query information about a single organization named IntTestOrg
+ cisco.meraki.meraki_organization:
+ auth_key: '{{ auth_key }}'
+ org_name: IntTestOrgRenamed
+ state: query
+ register: query_org
+
+ - name: Query information about IntTestOrg by organization ID
+ cisco.meraki.meraki_organization:
+ auth_key: '{{ auth_key }}'
+ org_id: '{{ query_org.data.id }}'
+ state: query
+ register: query_org_id
+
+ - name: Query assertions
+ ansible.builtin.assert:
+ that:
+ - query_org.data.id is defined
+ - query_all.changed == False
+ - query_all.data | length >= 1
+ - 'query_org.data.name == "IntTestOrgRenamed"'
+ - 'query_org_id.data.id == query_org.data.id'
+
+ - name: Delete without confirmation code
+ cisco.meraki.meraki_organization:
+ auth_key: '{{ auth_key }}'
+ state: absent
+ org_name: IntTestOrgCloned
+ register: delete_no_confirm
+ ignore_errors: true
+
+ - name: Assert deletion error
+ ansible.builtin.assert:
+ that:
+ 'delete_no_confirm.msg == "delete_confirm must match the network ID of the network to be deleted."'
always:
- # - name: Pause playbook for more reliable deletion
- # pause:
- # minutes: 1
-
- - name: Delete cloned organizations with check mode
- meraki_organization:
- auth_key: '{{ auth_key }}'
- state: absent
- org_name: IntTestOrgCloned
- delete_confirm: '{{cloned_net_id}}'
- register: deleted_org_check
- check_mode: yes
-
- - assert:
- that:
- - deleted_org_check is changed
-
- - name: Delete cloned organizations
- meraki_organization:
- auth_key: '{{ auth_key }}'
- state: absent
- org_name: IntTestOrgCloned
- delete_confirm: '{{cloned_net_id}}'
- register: deleted_org
-
- - name: Delete renamed organization by id
- meraki_organization:
- auth_key: '{{ auth_key }}'
- state: absent
- org_id: '{{renamed_org_id}}'
- delete_confirm: '{{renamed_org_id}}'
- register: deleted_org_id
-
- - assert:
- that:
- - deleted_org_id is changed
+ - name: Delete cloned organizations with check mode
+ cisco.meraki.meraki_organization:
+ auth_key: '{{ auth_key }}'
+ state: absent
+ org_name: IntTestOrgCloned
+ delete_confirm: '{{ cloned_net_id }}'
+ register: deleted_org_check
+ check_mode: true
+
+ - name: Assert organization deletion changed
+ ansible.builtin.assert:
+ that:
+ - deleted_org_check is changed
+
+ - name: Delete cloned organizations
+ cisco.meraki.meraki_organization:
+ auth_key: '{{ auth_key }}'
+ state: absent
+ org_name: IntTestOrgCloned
+ delete_confirm: '{{ cloned_net_id }}'
+ register: deleted_org
+
+ - name: Delete renamed organization by id
+ cisco.meraki.meraki_organization:
+ auth_key: '{{ auth_key }}'
+ state: absent
+ org_id: '{{ renamed_org_id }}'
+ delete_confirm: '{{ renamed_org_id }}'
+ register: deleted_org_id
+
+ - name: Assert org_id deletion changed
+ ansible.builtin.assert:
+ that:
+ - deleted_org_id is changed
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_snmp/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_snmp/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_snmp/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_snmp/tasks/main.yml b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_snmp/tasks/main.yml
index ed0868a40..06b78d594 100644
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_snmp/tasks/main.yml
+++ b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_snmp/tasks/main.yml
@@ -3,288 +3,276 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
-- block:
- - name: Test an API key is provided
- fail:
- msg: Please define an API key
- when: auth_key is not defined
-
- - name: Create SNMP network
- meraki_network:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: present
- type: appliance
- delegate_to: localhost
- register: new_net
-
- - set_fact:
- net_id: new_net.data.id
-
- - name: Query all SNMP settings
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- state: query
- delegate_to: localhost
- register: snmp_query
-
- - debug:
- msg: '{{snmp_query}}'
-
- - name: Enable SNMPv2c
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- state: present
- v2c_enabled: true
- delegate_to: localhost
- register: snmp_v2_enable
-
- - debug:
- msg: '{{snmp_v2_enable}}'
-
- - assert:
- that:
- - snmp_v2_enable.data.v2_community_string is defined
- - snmp_v2_enable.data.v2c_enabled == true
-
- - name: Disable SNMPv2c
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- state: present
- v2c_enabled: False
- delegate_to: localhost
- register: snmp_v2_disable
-
- - assert:
- that:
- - snmp_v2_disable.data.v2_community_string is not defined
- - snmp_v2_disable.data.v2c_enabled == False
-
- - name: Enable SNMPv2c with org_id
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_id: '{{test_org_id}}'
- state: present
- v2c_enabled: true
- delegate_to: localhost
- register: snmp_v2_enable_id
-
- - debug:
- msg: '{{snmp_v2_enable_id}}'
-
- - assert:
- that:
- - snmp_v2_enable_id.data.v2_community_string is defined
- - snmp_v2_enable_id.data.v2c_enabled == true
-
- - name: Disable SNMPv2c with org_id
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_id: '{{test_org_id}}'
- state: present
- v2c_enabled: False
- delegate_to: localhost
- register: snmp_v2_disable_id
-
- - assert:
- that:
- - snmp_v2_disable_id.data.v2_community_string is not defined
- - snmp_v2_disable_id.data.v2c_enabled == False
-
- - name: Enable SNMPv3 with check mode
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- state: present
- v3_enabled: true
- v3_auth_mode: SHA
- v3_auth_pass: ansiblepass
- v3_priv_mode: AES128
- v3_priv_pass: ansiblepass
- delegate_to: localhost
- check_mode: yes
- register: snmp_v3_enable_check
-
- - assert:
- that:
- - snmp_v3_enable_check.data.v3_enabled == True
- - snmp_v3_enable_check.changed == True
-
- - name: Enable SNMPv3
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- state: present
- v3_enabled: true
- v3_auth_mode: SHA
- v3_auth_pass: ansiblepass
- v3_priv_mode: AES128
- v3_priv_pass: ansiblepass
- delegate_to: localhost
- register: snmp_v3_enable
-
- - assert:
- that:
- - snmp_v3_enable.data.v3_enabled == True
- - snmp_v3_enable.changed == True
-
- - name: Check for idempotency
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- state: present
- v3_enabled: true
- v3_auth_mode: SHA
- v3_auth_pass: ansiblepass
- v3_priv_mode: AES128
- v3_priv_pass: ansiblepass
- delegate_to: localhost
- register: snmp_idempotent
-
- - debug:
- msg: '{{snmp_idempotent}}'
-
- - assert:
- that:
- - snmp_idempotent.changed == False
- - snmp_idempotent.data is defined
-
- - name: Add peer IPs
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- state: present
- v3_enabled: true
- v3_auth_mode: SHA
- v3_auth_pass: ansiblepass
- v3_priv_mode: AES128
- v3_priv_pass: ansiblepass
- peer_ips:
- - 1.1.1.1
- - 2.2.2.2
- delegate_to: localhost
- register: peers
-
- - debug:
- msg: '{{peers}}'
-
- - assert:
- that:
- - peers.data.peer_ips is defined
-
- - name: Set short password
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- state: present
- v3_enabled: true
- v3_auth_mode: SHA
- v3_auth_pass: ansible
- v3_priv_mode: AES128
- v3_priv_pass: ansible
- delegate_to: localhost
- register: short_password
- ignore_errors: yes
-
- - assert:
- that:
- - '"at least 8" in short_password.msg'
-
- - name: Set network access type to community string
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: present
- access: community
- community_string: abc123
- delegate_to: localhost
- register: set_net_community
-
- - debug:
- var: set_net_community
-
- - assert:
- that:
- - set_net_community is changed
- - set_net_community.data is defined
-
- - name: Set network access type to username
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: present
- access: users
- users:
- - username: ansibleuser
- passphrase: ansiblepass
- delegate_to: localhost
- register: set_net_user
-
- - debug:
- var: set_net_user
-
- - assert:
- that:
- - set_net_user is changed
- - set_net_user.data is defined
-
- - name: Set network access type to none
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: present
- access: none
- delegate_to: localhost
- register: set_net_none
-
- - debug:
- var: set_net_none
-
- - assert:
- that:
- - set_net_none is changed
- - set_net_none.data is defined
-
- - name: Query network SNMP settings
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: query
- delegate_to: localhost
- register: get_net
-
- - debug:
- var: get_net
-
- - assert:
- that:
- - get_net.data is defined
+- name: Execute teests against meraki_snmp
+ block:
+ - name: Test an API key is provided
+ ansible.builtin.fail:
+ msg: Please define an API key
+ when: auth_key is not defined
+
+ - name: Create SNMP network
+ cisco.meraki.meraki_network:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: present
+ type: appliance
+ delegate_to: localhost
+ register: new_net
+
+ - name: Set net_id
+ ansible.builtin.set_fact:
+ net_id: new_net.data.id
+
+ - name: Query all SNMP settings
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: query
+ delegate_to: localhost
+ register: snmp_query
+
+ - name: Enable SNMPv2c
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ v2c_enabled: true
+ delegate_to: localhost
+ register: snmp_v2_enable
+
+ - name: Assert v2c is enabled
+ ansible.builtin.assert:
+ that:
+ - snmp_v2_enable.data.v2_community_string is defined
+ - snmp_v2_enable.data.v2c_enabled == true
+
+ - name: Disable SNMPv2c
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ v2c_enabled: false
+ delegate_to: localhost
+ register: snmp_v2_disable
+
+ - name: Assert v2c is disabled
+ ansible.builtin.assert:
+ that:
+ - snmp_v2_disable.data.v2_community_string is not defined
+ - snmp_v2_disable.data.v2c_enabled == False
+
+ - name: Enable SNMPv2c with org_id
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_id: '{{ test_org_id }}'
+ state: present
+ v2c_enabled: true
+ delegate_to: localhost
+ register: snmp_v2_enable_id
+
+ - name: Assert v2c is enabled with org_id
+ ansible.builtin.assert:
+ that:
+ - snmp_v2_enable_id.data.v2_community_string is defined
+ - snmp_v2_enable_id.data.v2c_enabled == true
+
+ - name: Disable SNMPv2c with org_id
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_id: '{{ test_org_id }}'
+ state: present
+ v2c_enabled: false
+ delegate_to: localhost
+ register: snmp_v2_disable_id
+
+ - name: Assert v2c is disabled with org_id
+ ansible.builtin.assert:
+ that:
+ - snmp_v2_disable_id.data.v2_community_string is not defined
+ - snmp_v2_disable_id.data.v2c_enabled == False
+
+ - name: Enable SNMPv3 with check mode
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ v3_enabled: true
+ v3_auth_mode: SHA
+ v3_auth_pass: ansiblepass
+ v3_priv_mode: AES128
+ v3_priv_pass: ansiblepass
+ delegate_to: localhost
+ check_mode: true
+ register: snmp_v3_enable_check
+
+ - name: Assert check mode
+ ansible.builtin.assert:
+ that:
+ - snmp_v3_enable_check.data.v3_enabled == True
+ - snmp_v3_enable_check.changed == True
+
+ - name: Enable SNMPv3
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ v3_enabled: true
+ v3_auth_mode: SHA
+ v3_auth_pass: ansiblepass
+ v3_priv_mode: AES128
+ v3_priv_pass: ansiblepass
+ delegate_to: localhost
+ register: snmp_v3_enable
+
+ - name: Assert v3 enabled
+ ansible.builtin.assert:
+ that:
+ - snmp_v3_enable.data.v3_enabled == True
+ - snmp_v3_enable.changed == True
+
+ - name: Check for idempotency
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ v3_enabled: true
+ v3_auth_mode: SHA
+ v3_auth_pass: ansiblepass
+ v3_priv_mode: AES128
+ v3_priv_pass: ansiblepass
+ delegate_to: localhost
+ register: snmp_idempotent
+
+ - name: Assert idempotency
+ ansible.builtin.assert:
+ that:
+ - snmp_idempotent.changed == False
+ - snmp_idempotent.data is defined
+
+ - name: Add peer IPs
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ v3_enabled: true
+ v3_auth_mode: SHA
+ v3_auth_pass: ansiblepass
+ v3_priv_mode: AES128
+ v3_priv_pass: ansiblepass
+ peer_ips:
+ - 1.1.1.1
+ - 2.2.2.2
+ delegate_to: localhost
+ register: peers
+
+ - name: Assert peer_ips is defined
+ ansible.builtin.assert:
+ that:
+ - peers.data.peer_ips is defined
+
+ - name: Set short password
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ v3_enabled: true
+ v3_auth_mode: SHA
+ v3_auth_pass: ansible
+ v3_priv_mode: AES128
+ v3_priv_pass: ansible
+ delegate_to: localhost
+ register: short_password
+ ignore_errors: true
+
+ - name: Assert password length
+ ansible.builtin.assert:
+ that:
+ - '"at least 8" in short_password.msg'
+
+ - name: Set network access type to community string
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: present
+ access: community
+ community_string: abc123
+ delegate_to: localhost
+ register: set_net_community
+
+ - name: Assert community string
+ ansible.builtin.assert:
+ that:
+ - set_net_community is changed
+ - set_net_community.data is defined
+
+ - name: Set network access type to username
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: present
+ access: users
+ users:
+ - username: ansibleuser
+ passphrase: ansiblepass
+ delegate_to: localhost
+ register: set_net_user
+
+ - name: Assert access type
+ ansible.builtin.assert:
+ that:
+ - set_net_user is changed
+ - set_net_user.data is defined
+
+ - name: Set network access type to none
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: present
+ access: none
+ delegate_to: localhost
+ register: set_net_none
+
+ - name: Assert access type of none
+ ansible.builtin.assert:
+ that:
+ - set_net_none is changed
+ - set_net_none.data is defined
+
+ - name: Query network SNMP settings
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: query
+ delegate_to: localhost
+ register: get_net
+
+ - name: Assert query
+ ansible.builtin.assert:
+ that:
+ - get_net.data is defined
always:
- - name: Disable SNMPv3
- meraki_snmp:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- state: present
- v3_enabled: no
- v3_auth_mode: SHA
- v3_auth_pass: ansiblepass
- v3_priv_mode: AES128
- v3_priv_pass: ansiblepass
- delegate_to: localhost
-
- - name: Delete SNMP network
- meraki_network:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: absent
- delegate_to: localhost
+ - name: Disable SNMPv3
+ cisco.meraki.meraki_snmp:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ state: present
+ v3_enabled: false
+ v3_auth_mode: SHA
+ v3_auth_pass: ansiblepass
+ v3_priv_mode: AES128
+ v3_priv_pass: ansiblepass
+ delegate_to: localhost
+
+ - name: Delete SNMP network
+ cisco.meraki.meraki_network:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: absent
+ delegate_to: localhost
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ssid/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ssid/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_ssid/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_syslog/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_syslog/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_syslog/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_syslog/tasks/main.yml b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_syslog/tasks/main.yml
index 8bf518472..dc62a956b 100644
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_syslog/tasks/main.yml
+++ b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_syslog/tasks/main.yml
@@ -3,226 +3,233 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
-- block:
- - name: Test an API key is provided
- fail:
- msg: Please define an API key
- when: auth_key is not defined
-
- - set_fact:
- syslog_test_net_name: 'syslog_{{test_net_name}}'
-
- - name: Create network with type appliance and switch
- meraki_network:
- auth_key: '{{ auth_key }}'
- state: present
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- type:
- - appliance
- - wireless
- delegate_to: localhost
- register: new_net
-
- - set_fact:
- net_id: '{{new_net.data.id}}'
-
- - name: Query syslog settings
- meraki_syslog:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: query
- delegate_to: localhost
- register: query_all
-
- - name: Set syslog server
- meraki_syslog:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: present
- servers:
- - host: 192.0.1.2
- port: 514
- roles:
- - Appliance event log
- - Flows
- delegate_to: localhost
- register: create_server
-
- - assert:
- that:
- - create_server['data']['servers'][0]['host'] == "192.0.1.2"
- - create_server is changed
-
- - name: Set syslog server with idempotency
- meraki_syslog:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: present
- servers:
- - host: 192.0.1.2
- port: 514
- roles:
- - Appliance event log
- - Flows
- delegate_to: localhost
- register: create_server_idempotency
-
- - assert:
- that:
- - create_server_idempotency.changed == False
- - create_server_idempotency.data is defined
-
- - name: Set syslog server with wireless Event log
- meraki_syslog:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: present
- servers:
- - host: 192.0.1.2
- port: 514
- roles:
- - Appliance event log
- - Flows
- - wireless Event log
- delegate_to: localhost
- register: create_server
-
- - assert:
- that:
- - create_server['data']['servers'][0]['host'] == "192.0.1.2"
- - create_server is changed
-
- - name: Set syslog server with wireless Event log with idempotency
- meraki_syslog:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: present
- servers:
- - host: 192.0.1.2
- port: 514
- roles:
- - Appliance event log
- - Flows
- - wireless event log
- delegate_to: localhost
- register: create_server_idempotency
-
- - assert:
- that:
- - create_server_idempotency.changed == False
- - create_server_idempotency.data is defined
-
- - name: Set syslog servers to address bug 288
- meraki_syslog:
- auth_key: "{{ auth_key }}"
- state: present
- org_name: "{{ test_org_name }}"
- net_name: "{{ test_net_name }}"
- servers:
- - host: "10.3.15.11"
- port: 604
- roles:
- - Appliance event log
- - Security events
- - host: "10.5.15.11"
- port: 604
- roles:
- - Appliance event log
- - Security events
- - host: "10.9.15.11"
- port: 604
- roles:
- - Appliance event log
- - Security events
- - host: "10.5.250.12"
- port: 514
- roles:
- - Appliance event log
- - Security events
-
- - name: Set multiple syslog servers
- meraki_syslog:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_id: '{{net_id}}'
- state: present
- servers:
- - host: 192.0.1.3
- port: 514
- roles:
- - Appliance event log
- - host: 192.0.1.4
- port: 514
- roles:
- - Appliance event log
- - Flows
- - host: 192.0.1.5
- port: 514
- roles:
- - Flows
- delegate_to: localhost
- register: create_multiple_servers
-
- - assert:
- that:
- - create_multiple_servers['data']['servers'][0]['host'] == "192.0.1.3"
- - create_multiple_servers['data']['servers'][1]['host'] == "192.0.1.4"
- - create_multiple_servers['data']['servers'][2]['host'] == "192.0.1.5"
- - create_multiple_servers['data']['servers'] | length == 3
-
- - name: Create syslog server with bad name
- meraki_syslog:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: present
- servers:
- - host: 192.0.1.6
- port: 514
- roles:
- - Invalid role
- delegate_to: localhost
- register: invalid_role
- ignore_errors: yes
-
- - assert:
- that:
- - '"Invalid role found in" in invalid_role.msg'
-
- - name: Add role to existing syslog server # Adding doesn't work, just creation
- meraki_syslog:
- auth_key: '{{auth_key}}'
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
- state: present
- servers:
- - host: 192.0.1.2
- port: 514
- roles:
- - Flows
- delegate_to: localhost
- register: add_role
-
- - debug:
- msg: '{{add_role.data}}'
-
- - assert:
- that:
- - add_role.data.servers.0.roles.0 == 'Flows'
+- name: Execute tasks for syslog module
+ block:
+ - name: Test an API key is provided
+ ansible.builtin.fail:
+ msg: Please define an API key
+ when: auth_key is not defined
+
+ - name: Set test network name
+ ansible.builtin.set_fact:
+ syslog_test_net_name: 'syslog_{{ test_net_name }}'
+
+ - name: Create network with type appliance and switch
+ cisco.meraki.meraki_network:
+ auth_key: '{{ auth_key }}'
+ state: present
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ type:
+ - appliance
+ - wireless
+ delegate_to: localhost
+ register: new_net
+
+ - name: Set net_id
+ ansible.builtin.set_fact:
+ net_id: '{{ new_net.data.id }}'
+
+ - name: Query syslog settings
+ cisco.meraki.meraki_syslog:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: query
+ delegate_to: localhost
+ register: query_all
+
+ - name: Set syslog server
+ cisco.meraki.meraki_syslog:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: present
+ servers:
+ - host: 192.0.1.2
+ port: 514
+ roles:
+ - Appliance event log
+ - Flows
+ delegate_to: localhost
+ register: create_server
+
+ - name: Assert host IP address
+ ansible.builtin.assert:
+ that:
+ - create_server['data']['servers'][0]['host'] == "192.0.1.2"
+ - create_server is changed
+
+ - name: Set syslog server with idempotency
+ cisco.meraki.meraki_syslog:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: present
+ servers:
+ - host: 192.0.1.2
+ port: 514
+ roles:
+ - Appliance event log
+ - Flows
+ delegate_to: localhost
+ register: create_server_idempotency
+
+ - name: Assert idempotency
+ ansible.builtin.assert:
+ that:
+ - create_server_idempotency.changed == False
+ - create_server_idempotency.data is defined
+
+ - name: Set syslog server with wireless Event log
+ cisco.meraki.meraki_syslog:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: present
+ servers:
+ - host: 192.0.1.2
+ port: 514
+ roles:
+ - Appliance event log
+ - Flows
+ - wireless Event log
+ delegate_to: localhost
+ register: create_server
+
+ - name: Assert host IP address
+ ansible.builtin.assert:
+ that:
+ - create_server['data']['servers'][0]['host'] == "192.0.1.2"
+ - create_server is changed
+
+ - name: Set syslog server with wireless Event log with idempotency
+ cisco.meraki.meraki_syslog:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: present
+ servers:
+ - host: 192.0.1.2
+ port: 514
+ roles:
+ - Appliance event log
+ - Flows
+ - wireless event log
+ delegate_to: localhost
+ register: create_server_idempotency
+
+ - name: Assert idempotency
+ ansible.builtin.assert:
+ that:
+ - create_server_idempotency.changed == False
+ - create_server_idempotency.data is defined
+
+ - name: Set syslog servers to address bug 288
+ cisco.meraki.meraki_syslog:
+ auth_key: "{{ auth_key }}"
+ state: present
+ org_name: "{{ test_org_name }}"
+ net_name: "{{ test_net_name }}"
+ servers:
+ - host: "10.3.15.11"
+ port: 604
+ roles:
+ - Appliance event log
+ - Security events
+ - host: "10.5.15.11"
+ port: 604
+ roles:
+ - Appliance event log
+ - Security events
+ - host: "10.9.15.11"
+ port: 604
+ roles:
+ - Appliance event log
+ - Security events
+ - host: "10.5.250.12"
+ port: 514
+ roles:
+ - Appliance event log
+ - Security events
+
+ - name: Set multiple syslog servers
+ cisco.meraki.meraki_syslog:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_id: '{{ net_id }}'
+ state: present
+ servers:
+ - host: 192.0.1.3
+ port: 514
+ roles:
+ - Appliance event log
+ - host: 192.0.1.4
+ port: 514
+ roles:
+ - Appliance event log
+ - Flows
+ - host: 192.0.1.5
+ port: 514
+ roles:
+ - Flows
+ delegate_to: localhost
+ register: create_multiple_servers
+
+ - name: Assert valid servers
+ ansible.builtin.assert:
+ that:
+ - create_multiple_servers['data']['servers'][0]['host'] == "192.0.1.3"
+ - create_multiple_servers['data']['servers'][1]['host'] == "192.0.1.4"
+ - create_multiple_servers['data']['servers'][2]['host'] == "192.0.1.5"
+ - create_multiple_servers['data']['servers'] | length == 3
+
+ - name: Create syslog server with bad name
+ cisco.meraki.meraki_syslog:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: present
+ servers:
+ - host: 192.0.1.6
+ port: 514
+ roles:
+ - Invalid role
+ delegate_to: localhost
+ register: invalid_role
+ ignore_errors: true
+
+ - name: Assert "Invalid role found" in previous tasks error
+ ansible.builtin.assert:
+ that:
+ - '"Invalid role found in" in invalid_role.msg'
+
+ - name: Add role to existing syslog server # Adding doesn't work, just creation
+ cisco.meraki.meraki_syslog:
+ auth_key: '{{ auth_key }}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
+ state: present
+ servers:
+ - host: 192.0.1.2
+ port: 514
+ roles:
+ - Flows
+ delegate_to: localhost
+ register: add_role
+
+ - name: Assert flows is the role
+ ansible.builtin.assert:
+ that:
+ - add_role.data.servers.0.roles.0 == 'Flows'
always:
- name: Delete syslog test network
- meraki_network:
+ cisco.meraki.meraki_network:
auth_key: '{{ auth_key }}'
state: absent
- org_name: '{{test_org_name}}'
- net_name: '{{test_net_name}}'
+ org_name: '{{ test_org_name }}'
+ net_name: '{{ test_net_name }}'
delegate_to: localhost
register: delete_all
- ignore_errors: yes
+ ignore_errors: true
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/aliases
deleted file mode 100644
index ad7ccf7ad..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/aliases
+++ /dev/null
@@ -1 +0,0 @@
-unsupported
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/tasks/main.yml b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/tasks/main.yml
index f671fc928..a75e73d69 100644
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/tasks/main.yml
+++ b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/tasks/main.yml
@@ -4,4 +4,5 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
- name: Run test cases
- include: tests.yml ansible_connection=local
+ ansible.builtin.include_tasks:
+ file: tests.yml
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/tasks/tests.yml b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/tasks/tests.yml
index 5455336e8..52d952243 100644
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/tasks/tests.yml
+++ b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook/tasks/tests.yml
@@ -9,6 +9,7 @@
ansible.builtin.fail:
msg: Please define an API key
when: auth_key is not defined
+ delegate_to: localhost
- name: Create test network
cisco.meraki.meraki_network:
@@ -17,6 +18,7 @@
org_name: '{{ test_org_name }}'
net_name: '{{ test_net_name }}'
type: appliance
+ delegate_to: localhost
- name: Query for any webhooks expecting None
cisco.meraki.meraki_webhook:
@@ -25,16 +27,19 @@
org_name: '{{ test_org_name }}'
net_name: '{{ test_net_name }}'
register: query_none
+ delegate_to: localhost
- name: Query for any webhooks expecting None - debug
ansible.builtin.debug:
var: query_none
+ delegate_to: localhost
- name: Query for any webhooks expecting None - assert
ansible.builtin.assert:
that:
- query_none is not changed
- query_none.data[0] is not defined
+ delegate_to: localhost
- name: Create webhook with check mode
cisco.meraki.meraki_webhook:
@@ -47,16 +52,19 @@
shared_secret: shhhdonttellanyone
check_mode: true
register: create_one_check
+ delegate_to: localhost
- name: Create webhook with check mode - debug
ansible.builtin.debug:
var: create_one_check
+ delegate_to: localhost
- name: Create webhook with check mode - assert
ansible.builtin.assert:
that:
- create_one_check is changed
- create_one_check.data is defined
+ delegate_to: localhost
- name: Create webhook
cisco.meraki.meraki_webhook:
@@ -68,20 +76,24 @@
url: https://webhook.site/8eb5b76f-b167-4cb8-9fc4-42621b724244
shared_secret: shhhdonttellanyone
register: create_one
+ delegate_to: localhost
- name: Create webhook - debug
ansible.builtin.debug:
var: create_one
+ delegate_to: localhost
- name: Create webhook - assert
ansible.builtin.assert:
that:
- create_one is changed
- create_one.data is defined
+ delegate_to: localhost
- name: Set webhook_id for future use
ansible.builtin.set_fact:
webhook_id: '{{ create_one.data.id }}'
+ delegate_to: localhost
- name: Query all webhooks expecting 1
cisco.meraki.meraki_webhook:
@@ -90,10 +102,12 @@
org_name: '{{ test_org_name }}'
net_name: '{{ test_net_name }}'
register: query_one
+ delegate_to: localhost
- name: Query all webhooks expecting 1 - debug
ansible.builtin.debug:
var: query_one
+ delegate_to: localhost
- name: Query all webhooks expecting 1 - assert
ansible.builtin.assert:
@@ -101,6 +115,7 @@
- query_one.data is defined
- query_one.data[0] is defined
- query_one.data[1] is not defined
+ delegate_to: localhost
- name: Query one webhook
cisco.meraki.meraki_webhook:
@@ -110,15 +125,18 @@
net_name: '{{ test_net_name }}'
name: Test_Hook
register: query_one
+ delegate_to: localhost
- name: Query one webhook - debug
ansible.builtin.debug:
var: query_one
+ delegate_to: localhost
- name: Query one webhook - assert
ansible.builtin.assert:
that:
- query_one.data is defined
+ delegate_to: localhost
- name: Query one webhook with id
cisco.meraki.meraki_webhook:
@@ -128,15 +146,18 @@
net_name: '{{ test_net_name }}'
webhook_id: '{{ webhook_id }}'
register: query_one_id
+ delegate_to: localhost
- name: Query one webhook with id - debug
ansible.builtin.debug:
var: query_one_id
+ delegate_to: localhost
- name: Query one webhook with id - assert
ansible.builtin.assert:
that:
- query_one_id.data is defined
+ delegate_to: localhost
- name: Update webhook with check mode
cisco.meraki.meraki_webhook:
@@ -149,12 +170,14 @@
shared_secret: shhhdonttellanyonehere
check_mode: true
register: update_check
+ delegate_to: localhost
- name: Update webhook with check mode - assert
ansible.builtin.assert:
that:
- update_check is changed
- update_check.data is defined
+ delegate_to: localhost
- name: Update webhook
cisco.meraki.meraki_webhook:
@@ -166,10 +189,12 @@
url: https://webhook.site/8eb5b76f-b167-4cb8-9fc4-42621b724244
shared_secret: shhhdonttellanyonehere
register: update
+ delegate_to: localhost
- name: Update webhook - debug
ansible.builtin.debug:
var: update
+ delegate_to: localhost
- name: Update webhook - assert
ansible.builtin.assert:
@@ -177,6 +202,7 @@
- update is changed
- update.data is defined
- update.data.shared_secret is not defined
+ delegate_to: localhost
- name: Update webhook with idempotency with shared secret
cisco.meraki.meraki_webhook:
@@ -188,10 +214,12 @@
url: https://webhook.site/8eb5b76f-b167-4cb8-9fc4-42621b724244
shared_secret: shhhdonttellanyonehere
register: update_idempotent
+ delegate_to: localhost
- name: Update webhook with idempotency with shared secret - debug
ansible.builtin.debug:
var: update_idempotent
+ delegate_to: localhost
# response will always be "changed" since shared secret is not sent back in the response.
- name: Update webhook with idempotency with shared secret - assert
@@ -200,6 +228,7 @@
- update_idempotent is changed
- update_idempotent.data is defined
- update_idempotent.data.shared_secret is not defined
+ delegate_to: localhost
- name: Update webhook with idempotency without shared secret
cisco.meraki.meraki_webhook:
@@ -210,6 +239,7 @@
name: Test_Hook
url: https://webhook.site/8eb5b76f-b167-4cb8-9fc4-42621b724244
register: update_idempotent2
+ delegate_to: localhost
- name: Update webhook with idempotency without shared secret - debug
ansible.builtin.debug:
@@ -233,6 +263,7 @@
url: https://webhook.site/8eb5b76f-b167-4cb8-9fc4-42621b724244
shared_secret: shhhdonttellanyonehereid
register: update_id
+ delegate_to: localhost
- name: Update webhook with id - debug
ansible.builtin.debug:
@@ -254,6 +285,7 @@
name: TestPayloadTemplate
body: "a fake body"
register: payload_template
+ delegate_to: localhost
- name: Debug payload_template
ansible.builtin.debug:
@@ -270,6 +302,7 @@
url: https://webhook.site/8eb5b76f-b167
shared_secret: shhhdonttellanyone
register: webhook_with_template
+ delegate_to: localhost
- name: Create webhook with a payload template - debug
ansible.builtin.debug:
@@ -290,6 +323,7 @@
net_name: '{{ test_net_name }}'
name: Test_Hook_with_template
register: delete_hook_with_template
+ delegate_to: localhost
- name: Delete webhook with payload template - debug
ansible.builtin.debug:
@@ -310,6 +344,7 @@
test: test
url: https://webhook.site/8eb5b76f-b167-4cb8-9fc4-42621b724244
register: webhook_test
+ delegate_to: localhost
- name: Set test_id for future use
ansible.builtin.set_fact:
@@ -327,6 +362,7 @@
net_name: '{{ test_net_name }}'
test_id: '{{ test_id }}'
register: webhook_test_status
+ delegate_to: localhost
- name: Get webhook status - debug
ansible.builtin.debug:
@@ -344,6 +380,7 @@
org_name: '{{ test_org_name }}'
net_name: '{{ test_net_name }}'
register: query_all
+ delegate_to: localhost
- name: Query all webhooks - debug
ansible.builtin.debug:
@@ -359,6 +396,7 @@
check_mode: true
register: delete_invalid
ignore_errors: true
+ delegate_to: localhost
- name: Delete webhook invalid webhook - debug
ansible.builtin.debug:
@@ -378,6 +416,7 @@
name: Test_Hook
check_mode: true
register: delete_check
+ delegate_to: localhost
- name: Delete webhook in check mode - debug
ansible.builtin.debug:
@@ -396,6 +435,7 @@
net_name: '{{ test_net_name }}'
name: Test_Hook
register: delete
+ delegate_to: localhost
- name: Delete webhook - debug
ansible.builtin.debug:
@@ -417,6 +457,7 @@
net_name: '{{ test_net_name }}'
state: absent
name: TestPayloadTemplate
+ delegate_to: localhost
- name: Delete test network
cisco.meraki.meraki_network:
@@ -424,3 +465,4 @@
state: absent
org_name: '{{ test_org_name }}'
net_name: '{{ test_net_name }}'
+ delegate_to: localhost
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook_payload_template/aliases b/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook_payload_template/aliases
deleted file mode 100644
index 06fe32bc6..000000000
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_webhook_payload_template/aliases
+++ /dev/null
@@ -1,2 +0,0 @@
-unsupported
-