This commit is contained in:
67
config.yaml
67
config.yaml
@@ -2,6 +2,7 @@
|
|||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
vars:
|
vars:
|
||||||
|
debug: false
|
||||||
nid: L_671599294431642401 # TaintonNet
|
nid: L_671599294431642401 # TaintonNet
|
||||||
vlans:
|
vlans:
|
||||||
- id: 1
|
- id: 1
|
||||||
@@ -25,16 +26,46 @@
|
|||||||
- id: 40
|
- id: 40
|
||||||
name: DMZ
|
name: DMZ
|
||||||
dhcp: true
|
dhcp: true
|
||||||
|
mx_ports:
|
||||||
|
- num: 3
|
||||||
|
enabled: true
|
||||||
|
type: access
|
||||||
|
vlan: 35
|
||||||
|
- num: 4
|
||||||
|
enabled: true
|
||||||
|
type: access
|
||||||
|
vlan: 10
|
||||||
|
- num: 5
|
||||||
|
enabled: false
|
||||||
|
- num: 6
|
||||||
|
enabled: false
|
||||||
|
- num: 7
|
||||||
|
enabled: false
|
||||||
|
- num: 8
|
||||||
|
enabled: false
|
||||||
|
- num: 9
|
||||||
|
enabled: false
|
||||||
|
- num: 10
|
||||||
|
enabled: false
|
||||||
|
- num: 11
|
||||||
|
enabled: false
|
||||||
|
- num: 12
|
||||||
|
enabled: true
|
||||||
|
type: trunk
|
||||||
|
vlan: 5
|
||||||
|
allowed_vlans: 6,10,25,35,40
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Get Me
|
- name: Get Me
|
||||||
cisco.meraki.administered_identities_me_info:
|
cisco.meraki.administered_identities_me_info:
|
||||||
meraki_suppress_logging: true
|
meraki_suppress_logging: true
|
||||||
register: me
|
register: me
|
||||||
|
when: debug
|
||||||
|
|
||||||
- name: Show current Meraki administrator
|
- name: Show current Meraki administrator
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ me.meraki_response.name }} - {{me.meraki_response.email}}"
|
msg: "{{ me.meraki_response.name }} - {{me.meraki_response.email}}"
|
||||||
|
when: debug
|
||||||
|
|
||||||
- name: Get all Organizations
|
- name: Get all Organizations
|
||||||
cisco.meraki.organizations_info:
|
cisco.meraki.organizations_info:
|
||||||
@@ -44,6 +75,7 @@
|
|||||||
- name: Show Organizations List
|
- name: Show Organizations List
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ organizations | json_query('meraki_response[*].name') }}"
|
msg: "{{ organizations | json_query('meraki_response[*].name') }}"
|
||||||
|
when: debug
|
||||||
|
|
||||||
- name: Enable Vlans on the MX
|
- name: Enable Vlans on the MX
|
||||||
cisco.meraki.networks_appliance_vlans_settings:
|
cisco.meraki.networks_appliance_vlans_settings:
|
||||||
@@ -54,6 +86,7 @@
|
|||||||
- name: Show VLANs
|
- name: Show VLANs
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ vlans }}"
|
msg: "{{ vlans }}"
|
||||||
|
when: debug
|
||||||
|
|
||||||
- name: Create VLANs on MX
|
- name: Create VLANs on MX
|
||||||
cisco.meraki.networks_appliance_vlans:
|
cisco.meraki.networks_appliance_vlans:
|
||||||
@@ -92,3 +125,37 @@
|
|||||||
dhcpHandling: "Do not respond to DHCP requests"
|
dhcpHandling: "Do not respond to DHCP requests"
|
||||||
loop: "{{ vlans }}"
|
loop: "{{ vlans }}"
|
||||||
when: not item.dhcp
|
when: not item.dhcp
|
||||||
|
|
||||||
|
- name: Configure MX Trunk Ports
|
||||||
|
cisco.meraki.networks_appliance_ports:
|
||||||
|
state: present
|
||||||
|
networkId: "{{ nid }}"
|
||||||
|
portId: "{{ item.num }}"
|
||||||
|
enabled: true
|
||||||
|
type: trunk
|
||||||
|
vlan: "{{ item.vlan }}" # Native VLAN
|
||||||
|
allowedVlans: "{{ item.allowed_vlans }}"
|
||||||
|
dropUntaggedTraffic: false
|
||||||
|
loop: "{{ mx_ports }}"
|
||||||
|
when: item.enabled and item.type == "trunk"
|
||||||
|
|
||||||
|
- name: Configure MX Access Ports
|
||||||
|
cisco.meraki.networks_appliance_ports:
|
||||||
|
state: present
|
||||||
|
networkId: "{{ nid }}"
|
||||||
|
portId: "{{ item.num }}"
|
||||||
|
enabled: true
|
||||||
|
accessPolicy: open
|
||||||
|
type: access
|
||||||
|
vlan: "{{ item.vlan }}"
|
||||||
|
loop: "{{ mx_ports }}"
|
||||||
|
when: item.enabled and item.type == "access"
|
||||||
|
|
||||||
|
- name: Disable Inactive MX Ports
|
||||||
|
cisco.meraki.networks_appliance_ports:
|
||||||
|
state: present
|
||||||
|
networkId: "{{ nid }}"
|
||||||
|
portId: "{{ item.num }}"
|
||||||
|
enabled: false
|
||||||
|
loop: "{{ mx_ports }}"
|
||||||
|
when: not item.enabled
|
||||||
|
|||||||
Reference in New Issue
Block a user