Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes and Data Model Updates #17

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
exclude_paths:
- .cache/
- changelogs/
4 changes: 0 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ scratch/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

changelogs/.plugin_cache
changelogs/.plugin_cache.yaml
22 changes: 20 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,32 @@

**Topics**

- <a href="#v1-1-2">v1\.1\.2</a>
- <a href="#breaking-changes--porting-guide">Breaking Changes / Porting Guide</a>
- <a href="#bugfixes">Bugfixes</a>
- <a href="#v1-1-1">v1\.1\.1</a>
- <a href="#minor-changes">Minor Changes</a>
- <a href="#breaking-changes--porting-guide">Breaking Changes / Porting Guide</a>
- <a href="#breaking-changes--porting-guide-1">Breaking Changes / Porting Guide</a>
- <a href="#v1-1-0">v1\.1\.0</a>
- <a href="#release-summary">Release Summary</a>
- <a href="#new-plugins">New Plugins</a>
- <a href="#lookup">Lookup</a>

<a id="v1-1-2"></a>
## v1\.1\.2

<a id="breaking-changes--porting-guide"></a>
### Breaking Changes / Porting Guide

* manage\_meraki\_network \- updated data model so that tags are now a list

<a id="bugfixes"></a>
### 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

<a id="v1-1-1"></a>
## v1\.1\.1

Expand All @@ -18,7 +36,7 @@

* configure\_meraki\_mv \- Updated data handling for MQTT configuration with camera sense\.

<a id="breaking-changes--porting-guide"></a>
<a id="breaking-changes--porting-guide-1"></a>
### Breaking Changes / Porting Guide

* configure\_meraki\_mr \- Data model updated to support migration to latest cisco\.meraki certified collection\.
Expand Down
13 changes: 13 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Empty file added changelogs/fragments/.keep
Empty file.
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion roles/configure_meraki_mt/tasks/configure_mqtt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
35 changes: 5 additions & 30 deletions roles/configure_meraki_mx/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -578,3 +548,8 @@ argument_specs:
- ipRange
- port
- allowedCountries
value:
type: list
elements: str
required: false
description: Rule Value
51 changes: 49 additions & 2 deletions roles/configure_meraki_mx/tasks/configure_vlans.yml
Original file line number Diff line number Diff line change
@@ -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) }}"
Expand All @@ -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"
5 changes: 3 additions & 2 deletions roles/manage_meraki_network/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion roles/manage_meraki_network/tasks/manage_devices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down