From 362858e0deeded3dae5eb5cddcb19361f2b5bb8d Mon Sep 17 00:00:00 2001 From: Nick Thompson Date: Fri, 31 May 2024 15:55:30 +0000 Subject: [PATCH 1/3] bugfixes and datamodel updates for v1.1.2 --- .gitignore | 2 +- CHANGELOG.md | 22 +++++++- changelogs/changelog.yaml | 13 +++++ changelogs/fragments/.keep | 0 galaxy.yml | 2 +- .../tasks/configure_mqtt.yml | 2 +- .../meta/argument_specs.yml | 35 ++----------- .../tasks/configure_vlans.yml | 51 ++++++++++++++++++- .../meta/argument_specs.yml | 5 +- .../tasks/manage_devices.yml | 4 +- 10 files changed, 96 insertions(+), 40 deletions(-) create mode 100644 changelogs/fragments/.keep diff --git a/.gitignore b/.gitignore index 7b46599..4d974b5 100644 --- a/.gitignore +++ b/.gitignore @@ -162,4 +162,4 @@ scratch/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ -changelogs/.plugin_cache \ No newline at end of file +changelogs/.plugin_cache.yaml \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2305326..2f1c1e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,14 +2,32 @@ **Topics** +- v1\.1\.2 + - Breaking Changes / Porting Guide + - Bugfixes - v1\.1\.1 - Minor Changes - - Breaking Changes / Porting Guide + - Breaking Changes / Porting Guide - v1\.1\.0 - Release Summary - New Plugins - Lookup + +## v1\.1\.2 + + +### Breaking Changes / Porting Guide + +* manage\_meraki\_network \- updated data model so that tags are now a list + + +### Bugfixes + +* configure\_meraki\_mt \- fixed conditional preventing lookup dictionary creation +* configure\_meraki\_mx \- fixed VLAN provisioning and updates due to VLAN 1 already existing +* manage\_meraki\_network \- fixed device provisioning to include name and tags + ## v1\.1\.1 @@ -18,7 +36,7 @@ * configure\_meraki\_mv \- Updated data handling for MQTT configuration with camera sense\. - + ### Breaking Changes / Porting Guide * configure\_meraki\_mr \- Data model updated to support migration to latest cisco\.meraki certified collection\. diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 4ea296c..b5b7204 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -29,3 +29,16 @@ releases: - 1.1.0-update.yaml - 1.1.1-minor.yaml release_date: '2024-05-30' + 1.1.2: + changes: + breaking_changes: + - manage_meraki_network - updated data model so that tags are now a list + bugfixes: + - configure_meraki_mt - fixed conditional preventing lookup dictionary creation + - configure_meraki_mx - fixed VLAN provisioning and updates due to VLAN 1 already + existing + - manage_meraki_network - fixed device provisioning to include name and tags + fragments: + - v1.1.2-breaking.yaml + - v1.1.2-bugfixes.yaml + release_date: '2024-05-31' diff --git a/changelogs/fragments/.keep b/changelogs/fragments/.keep new file mode 100644 index 0000000..e69de29 diff --git a/galaxy.yml b/galaxy.yml index 742e7c8..50d0aac 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -9,7 +9,7 @@ namespace: wwt name: meraki # The version of the collection. Must be compatible with semantic versioning -version: 1.1.1 +version: 1.1.2 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/roles/configure_meraki_mt/tasks/configure_mqtt.yml b/roles/configure_meraki_mt/tasks/configure_mqtt.yml index dce2e60..fa6522f 100644 --- a/roles/configure_meraki_mt/tasks/configure_mqtt.yml +++ b/roles/configure_meraki_mt/tasks/configure_mqtt.yml @@ -67,7 +67,7 @@ loop: "{{ broker_result.results }}" loop_control: loop_var: result - when: not result.skipped + when: result.skipped is not defined - name: Enable MQTT Brokers cisco.meraki.networks_sensor_mqtt_brokers: diff --git a/roles/configure_meraki_mx/meta/argument_specs.yml b/roles/configure_meraki_mx/meta/argument_specs.yml index 5841808..586b7a5 100644 --- a/roles/configure_meraki_mx/meta/argument_specs.yml +++ b/roles/configure_meraki_mx/meta/argument_specs.yml @@ -530,42 +530,12 @@ argument_specs: elements: dict description: Layer 7 Firewall Rules options: - application: - type: dict - required: false - description: Application to filter - options: - id: - type: str - required: false - description: URI of application as defined by Meraki - name: - type: str - required: false - description: Name of application as defined by Meraki - countries: - type: list - required: false - description: List of countries - two leter ISO 3166-1 alpha-2 - elements: str - host: - type: str - required: false - description: FQDN of host to filter - ipRange: - type: str - required: false - description: CIDR range of IP, can append port with ":" policy: type: str required: false description: Policy to apply choices: - deny - port: - type: str - required: false - description: TCP or UDP port to filter type: type: str required: false @@ -578,3 +548,8 @@ argument_specs: - ipRange - port - allowedCountries + value: + type: list + elements: str + required: false + description: Rule Value diff --git a/roles/configure_meraki_mx/tasks/configure_vlans.yml b/roles/configure_meraki_mx/tasks/configure_vlans.yml index 9f114e3..bc9157f 100644 --- a/roles/configure_meraki_mx/tasks/configure_vlans.yml +++ b/roles/configure_meraki_mx/tasks/configure_vlans.yml @@ -1,23 +1,52 @@ --- -- name: Initial Configuration of MX VLANs for {{ appliance.name }} +- name: Query Existing MX VLANs + cisco.meraki.networks_appliance_vlans_info: + meraki_api_key: "{{ auth_key }}" + networkId: "{{ network_id }}" + register: vlan_result + +- name: Add discovered VLAN IDs to list + ansible.builtin.set_fact: + vlan_ids: >- + {{ vlan_ids | default([]) + [result.id] }} + loop: "{{ vlan_result.meraki_response }}" + loop_control: + loop_var: result + when: vlan_result is defined + +# +# First pass configuration throws the following errors when run +# when vlanId parameter is omitted: +# Error: Appliance.getNetworkApplianceVlan() missing 1 required positional argument: 'vlanId' +# +# When vlanId parameter is present: +# Error: An error occured when executing operation. +# The error was: appliance, getNetworkApplianceVlan - 404 Not Found, please wait a minute if the key or org was just newly created. +# +# VLANs are provisioned correctly regardless of error as noted above +# + +- name: First Pass Configuration of MX VLANs for {{ appliance.name }} cisco.meraki.networks_appliance_vlans: meraki_api_key: "{{ auth_key }}" state: "{{ vlan.state }}" networkId: "{{ network_id }}" id: "{{ vlan.id }}" + vlanId: "{{ vlan.id }}" name: "{{ vlan.name | default(omit) }}" subnet: "{{ vlan.subnet | default(omit) }}" applianceIp: "{{ vlan.appliance_ip | default(omit) }}" loop: "{{ appliance.vlans }}" loop_control: loop_var: vlan + when: vlan.id not in vlan_ids and vlan.state == "present" - name: Second Pass Configuration of MX VLANs for {{ appliance.name }} cisco.meraki.networks_appliance_vlans: meraki_api_key: "{{ auth_key }}" state: "{{ vlan.state }}" networkId: "{{ network_id }}" - id: "{{ vlan.id }}" + vlanId: "{{ vlan.id }}" name: "{{ vlan.name | default(omit) }}" reservedIpRanges: "{{ vlan.reserved_ip_range | default(omit) }}" fixedIpAssignments: "{{ vlan.fixed_ip_assignments | default(omit) }}" @@ -29,4 +58,22 @@ ((vlan.reserved_ip_range is defined) or (vlan.fixed_ip_assignments is defined) or (vlan.dns_nameservers is defined)) and + vlan.id not in vlan_ids and vlan.state == "present" + +- name: Update Configuration of Existing MX VLANs for {{ appliance.name }} + cisco.meraki.networks_appliance_vlans: + meraki_api_key: "{{ auth_key }}" + state: "{{ vlan.state }}" + networkId: "{{ network_id }}" + vlanId: "{{ vlan.id }}" + name: "{{ vlan.name | default(omit) }}" + subnet: "{{ vlan.subnet | default(omit) }}" + applianceIp: "{{ vlan.appliance_ip | default(omit) }}" + reservedIpRanges: "{{ vlan.reserved_ip_range | default(omit) }}" + fixedIpAssignments: "{{ vlan.fixed_ip_assignments | default(omit) }}" + dnsNameservers: "{{ vlan.dns_nameservers | default(omit) }}" + loop: "{{ appliance.vlans }}" + loop_control: + loop_var: vlan + when: vlan.id in vlan_ids and vlan.state == "present" diff --git a/roles/manage_meraki_network/meta/argument_specs.yml b/roles/manage_meraki_network/meta/argument_specs.yml index 00d0a57..bc6a11c 100644 --- a/roles/manage_meraki_network/meta/argument_specs.yml +++ b/roles/manage_meraki_network/meta/argument_specs.yml @@ -49,9 +49,10 @@ argument_specs: - present - absent tags: - type: str + type: list + elements: str required: false - description: Meraki Dashboard Tags (CSV list) + description: Meraki Dashboard Tags address: type: str required: false diff --git a/roles/manage_meraki_network/tasks/manage_devices.yml b/roles/manage_meraki_network/tasks/manage_devices.yml index dae305d..54b5633 100644 --- a/roles/manage_meraki_network/tasks/manage_devices.yml +++ b/roles/manage_meraki_network/tasks/manage_devices.yml @@ -46,7 +46,7 @@ - name: Update Network Devices block: - - name: Add Location Information to Network Devices + - name: Add Name and Location Information to Network Devices ansible.builtin.uri: url: "{{ dashboard_base_url }}/devices/{{ device.serial }}" method: PUT @@ -56,8 +56,10 @@ X-Cisco-Meraki-API-Key: "{{ auth_key }}" body_format: json body: + name: "{{ device.name }}" address: "{{ network.address | default(omit) }}" moveMapMarker: "{{ 'true' if network.address | default(omit) }}" + tags: "{{ device.tags | default(omit) }}" changed_when: api_result.status == 200 until: api_result.status != 429 delay: 5 From e0dfabb7c1c65e10c3913f3bebb82c008a5225e9 Mon Sep 17 00:00:00 2001 From: Nick Thompson Date: Fri, 31 May 2024 15:58:53 +0000 Subject: [PATCH 2/3] added .ansible-lint config file --- .ansible-lint | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .ansible-lint diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..d51ed21 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,4 @@ +--- +exclude_paths: + - .cache/ + - changelogs/ From b6f12d146c6238cbdd08c5cf3887ecb1d1f98752 Mon Sep 17 00:00:00 2001 From: Nick Thompson Date: Fri, 31 May 2024 16:04:33 +0000 Subject: [PATCH 3/3] removed workflow to check changelogs --- .github/workflows/ci.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7e0436b..66d3a15 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,15 +13,11 @@ on: - cron: '0 0 * * *' jobs: - changelog: - uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main - if: github.event_name == 'pull_request' ansible-lint: uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main all_green: if: ${{ always() }} needs: - - changelog - ansible-lint runs-on: ubuntu-latest steps: