diff options
Diffstat (limited to 'ansible_collections/cisco/meraki/playbooks')
52 files changed, 1425 insertions, 0 deletions
diff --git a/ansible_collections/cisco/meraki/playbooks/.DS_Store b/ansible_collections/cisco/meraki/playbooks/.DS_Store Binary files differnew file mode 100644 index 000000000..5008ddfcf --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/.DS_Store diff --git a/ansible_collections/cisco/meraki/playbooks/Bulk_change_DNS_from_file.yaml b/ansible_collections/cisco/meraki/playbooks/Bulk_change_DNS_from_file.yaml new file mode 100644 index 000000000..618f5d88d --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/Bulk_change_DNS_from_file.yaml @@ -0,0 +1,24 @@ +--- +# Notes: +# The playbook can't make changes if the device is using DHCP for IP assignment, it will just run and report success +# Works by imports the serial numbers of devices to use from a devices.yaml file + +- hosts: localhost + gather_facts: false + vars: + org_id: "XXXXXXX" + tasks: + - name: Include vars of devices.yaml into the 'devices' variable + include_vars: + file: devices.yaml + name: devices + + - name: Change DNS management information + cisco.meraki.devices_management_interface: + state: present + serial: "{{ item.value.serial_no }}" + wan1: + staticDns: + - 192.168.20.2 + - 8.8.8.8 + loop: "{{ lookup('dict', devices) }}" diff --git a/ansible_collections/cisco/meraki/playbooks/Create_a_Network.yaml b/ansible_collections/cisco/meraki/playbooks/Create_a_Network.yaml new file mode 100644 index 000000000..8e78b9215 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/Create_a_Network.yaml @@ -0,0 +1,15 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Create Network + cisco.meraki.networks: + state: present + organizationId: "828099381482762270" + name: Made With Ansible networks + notes: Made_with_anisble + productTypes: + - switch + - appliance + - wireless + timeZone: Australia/Sydney
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/Get_AP_Serials.yaml b/ansible_collections/cisco/meraki/playbooks/Get_AP_Serials.yaml new file mode 100644 index 000000000..593cdb445 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/Get_AP_Serials.yaml @@ -0,0 +1,21 @@ +--- +- hosts: localhost + vars: + org_id: "XXXXXXXX" + gather_facts: false + tasks: + - name: Get all organizations _devices + cisco.meraki.organizations_devices_info: + meraki_suppress_logging: true + organizationId: "{{ org_id }}" + total_pages: -1 + register: result + + - name: Filter APs with "wireless" productTypes and get Serial Number + set_fact: + filtered_aps: "{{ result.meraki_response | selectattr('productType', 'contains', 'wireless') | map(attribute='serial') | list }}" + register: aps + + - name: Show All Devices + ansible.builtin.debug: + msg: "{{ aps }}" diff --git a/ansible_collections/cisco/meraki/playbooks/Get_All_Devices.yaml b/ansible_collections/cisco/meraki/playbooks/Get_All_Devices.yaml new file mode 100644 index 000000000..e9f1ce422 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/Get_All_Devices.yaml @@ -0,0 +1,16 @@ +--- +- hosts: localhost + vars: + org_id: "XXXXXXXX" + gather_facts: false + tasks: + - name: Get all organizations _devices + cisco.meraki.organizations_devices_info: + meraki_suppress_logging: true + organizationId: "{{ org_id }}" + total_pages: -1 + register: org_devices + + - name: Show All Devices + ansible.builtin.debug: + msg: "{{ org_devices }}"
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/Get_IP_MGNT_info.yaml b/ansible_collections/cisco/meraki/playbooks/Get_IP_MGNT_info.yaml new file mode 100644 index 000000000..87e871335 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/Get_IP_MGNT_info.yaml @@ -0,0 +1,12 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Query management information + cisco.meraki.devices_management_interface_info: + serial: Q3XX-XXXX-XXXX + register: result + + - name: Show Results + ansible.builtin.debug: + msg: "{{ result }}"
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/Get_IP_MGNT_info_from_file.yaml b/ansible_collections/cisco/meraki/playbooks/Get_IP_MGNT_info_from_file.yaml new file mode 100644 index 000000000..768ae4e24 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/Get_IP_MGNT_info_from_file.yaml @@ -0,0 +1,19 @@ +--- +# Works by gettting the serial numbers of devices from the devices.yaml file +- hosts: localhost + gather_facts: false + tasks: + - name: Include vars of devices.yaml into the 'devices' variable + include_vars: + file: devices.yaml + name: devices + + - name: Query management information + cisco.meraki.devices_management_interface_info: + serial: "{{ item.value.serial_no }}" + register: result + loop: "{{ lookup('dict', devices) }}" + + - name: Show Results + ansible.builtin.debug: + msg: "{{ result }}"
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/Set_IP_MGNT_info.yaml b/ansible_collections/cisco/meraki/playbooks/Set_IP_MGNT_info.yaml new file mode 100644 index 000000000..52ee9381b --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/Set_IP_MGNT_info.yaml @@ -0,0 +1,16 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Change management information + cisco.meraki.devices_management_interface: + state: present + serial: XXXX-XXXX-XXXX + wan1: + staticDns: + - 192.168.20.2 + - 8.8.8.8 + staticGatewayIp: 192.168.20.1 + staticIp: 192.168.20.181 + staticSubnetMask: 255.255.255.0 + usingStaticIp: true
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/What_Org.yaml b/ansible_collections/cisco/meraki/playbooks/What_Org.yaml new file mode 100644 index 000000000..d1217d293 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/What_Org.yaml @@ -0,0 +1,12 @@ +--- +- hosts: meraki_servers + gather_facts: false + tasks: + - name: Get all Organizations + cisco.meraki.organizations_info: + meraki_suppress_logging: true + register: result + + - name: Show current Meraki administrator + ansible.builtin.debug: + msg: "{{ result | json_query('meraki_response[*].name') }}"
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/Who_Am_I.yaml b/ansible_collections/cisco/meraki/playbooks/Who_Am_I.yaml new file mode 100644 index 000000000..abbe8a6cd --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/Who_Am_I.yaml @@ -0,0 +1,21 @@ +--- +- hosts: meraki_servers + gather_facts: false + tasks: + - name: Get my administered identities + cisco.meraki.administered_identities_me_info: + meraki_suppress_logging: true + register: whoamiresult + + - name: Show current Meraki administrator + ansible.builtin.debug: + msg: "{{ whoamiresult.meraki_response.name }} - {{whoamiresult.meraki_response.email}}" + + - name: Get all Organizations + cisco.meraki.organizations_info: + meraki_suppress_logging: true + register: orgresults + + - name: Show current Meraki administrator + ansible.builtin.debug: + msg: "{{ orgresults | json_query('meraki_response[*].name') }}"
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/administered_identities_me_info.yml b/ansible_collections/cisco/meraki/playbooks/administered_identities_me_info.yml new file mode 100644 index 000000000..fb4314112 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/administered_identities_me_info.yml @@ -0,0 +1,28 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Get all administered _identities _me + cisco.meraki.administered_identities_me_info: + # meraki_api_key: "{{meraki_api_key}}" + # meraki_username: "{{meraki_username}}" + # meraki_password: "{{meraki_password}}" + # meraki_verify: "{{meraki_verify}}" + # meraki_port: "{{meraki_port}}" + # meraki_version: "{{meraki_version}}" + # meraki_debug: "{{meraki_debug}}" + # state: present + # management: + # details: + # - name: MSP ID + # value: '1234567' + # name: Test Ansible + # organizationId: "575334852396583071" + # api: + # enabled: false + meraki_suppress_logging: true + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/meraki/playbooks/credentials.template b/ansible_collections/cisco/meraki/playbooks/credentials.template new file mode 100644 index 000000000..99581dcbc --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/credentials.template @@ -0,0 +1,22 @@ +--- +meraki_api_key: "ABCD" +meraki_base_url: "https://api.meraki.com/api/v1" +meraki_single_request_timeout: "" +meraki_certificate_path: "" +meraki_requests_proxy: True +meraki_wait_on_rate_limit: 60 +meraki_nginx_429_retry_wait_time: 60 +meraki_action_batch_retry_wait_time: 60 +meraki_retry_4xx_error: False +meraki_retry_4xx_error_wait_time: 60 +meraki_maximum_retries: 2 +meraki_output_log: True +meraki_log_file_prefix: "meraki_api_" +meraki_log_path: "" +meraki_print_console: True +meraki_suppress_logging: False +meraki_simulate: False +meraki_be_geo_id: "" +meraki_caller: "" +meraki_use_iterator_for_get_pages: False +meraki_inherit_logging_config: False
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/credentials.yml b/ansible_collections/cisco/meraki/playbooks/credentials.yml new file mode 100644 index 000000000..d760e8fb2 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/credentials.yml @@ -0,0 +1,2 @@ +--- +meraki_api_key: "ABCD" diff --git a/ansible_collections/cisco/meraki/playbooks/device_blink_leds.yml b/ansible_collections/cisco/meraki/playbooks/device_blink_leds.yml new file mode 100644 index 000000000..1039f3000 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/device_blink_leds.yml @@ -0,0 +1,31 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Create + cisco.meraki.devices_blink_leds: + # meraki_base_url: "{{meraki_base_url}}" + # meraki_single_request_timeout: "{{meraki_single_request_timeout}}" + # meraki_certificate_path: "{{meraki_certificate_path}}" + # meraki_requests_proxy: "{{meraki_requests_proxy}}" + # meraki_wait_on_rate_limit: "{{meraki_wait_on_rate_limit}}" + # meraki_nginx_429_retry_wait_time: "{{meraki_nginx_429_retry_wait_time}}" + # meraki_action_batch_retry_wait_time: "{{meraki_action_batch_retry_wait_time}}" + # meraki_retry_4xx_error: "{{meraki_retry_4xx_error}}" + # meraki_retry_4xx_error_wait_time: "{{meraki_retry_4xx_error_wait_time}}" + # meraki_maximum_retries: "{{meraki_maximum_retries}}" + # meraki_output_log: "{{meraki_output_log}}" + # meraki_log_file_prefix: "{{meraki_log_file_prefix}}" + # meraki_log_path: "{{meraki_log_path}}" + # meraki_print_console: "{{meraki_print_console}}" + # meraki_suppress_logging: "{{meraki_suppress_logging}}" + # meraki_simulate: "{{meraki_simulate}}" + # meraki_be_geo_id: "{{meraki_be_geo_id}}" + # + # meraki_use_iterator_for_get_pages: "{{meraki_use_iterator_for_get_pages}}" + # meraki_inherit_logging_config: "{{meraki_inherit_logging_config}}" + meraki_suppress_logging: true + duration: 20 + duty: 50 + period: 160 + serial: "QBSB-AX45-LY9A" diff --git a/ansible_collections/cisco/meraki/playbooks/device_lldp_cdp.yml b/ansible_collections/cisco/meraki/playbooks/device_lldp_cdp.yml new file mode 100644 index 000000000..27174fa50 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/device_lldp_cdp.yml @@ -0,0 +1,16 @@ +--- + +- hosts: localhost + vars: + sn: Q4AC-YTF3-WQ66 + gather_facts: false + tasks: + + - name: Get device's LLDP and CDP neighbors + cisco.meraki.devices_lldp_cdp_info: + serial: "{{ sn }}" + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/meraki/playbooks/device_statuses.yml b/ansible_collections/cisco/meraki/playbooks/device_statuses.yml new file mode 100644 index 000000000..184379110 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/device_statuses.yml @@ -0,0 +1,16 @@ +--- + +- hosts: localhost + vars: + organization_id: 828099381482762270 + gather_facts: false + tasks: + + - name: Get all organization's devices statuses + cisco.meraki.organizations_devices_statuses_info: + organizationId: "{{ organization_id }}" + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/meraki/playbooks/devices.yaml b/ansible_collections/cisco/meraki/playbooks/devices.yaml new file mode 100644 index 000000000..6938b5d0d --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/devices.yaml @@ -0,0 +1,9 @@ +--- +device-1: + serial_no: Q3XX-XXXX-XXXX + +device-2: + serial_no: Q3XX-XXXX-XXXX + +device-3: + serial_no: Q3XX-XXXX-XXXX
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/devices.yml b/ansible_collections/cisco/meraki/playbooks/devices.yml new file mode 100644 index 000000000..0484243d1 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/devices.yml @@ -0,0 +1,19 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + # - name: Update by id + # cisco.meraki.devices: + # meraki_suppress_logging: false + # state: present + # # lat: "37.4180951010364" + # # lng: "-122.098531723021" + # # mac: 4c:c8:a1:11:01:0b + # name: My AP 3 + # serial: QBSD-36C3-473D + # # tags: ["testing"] + - name: change name of device + cisco.meraki.devices: + name: new name 12 + serial: QBSC-ALSL-3GXN + state: present
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/devices_info.yml b/ansible_collections/cisco/meraki/playbooks/devices_info.yml new file mode 100644 index 000000000..934f31bfe --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/devices_info.yml @@ -0,0 +1,18 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Get Device + cisco.meraki.devices_info: + meraki_suppress_logging: true + organizationId: "828099381482762270" + # serial: QBSD-36C3-473D + # tags: ["recently-added"] + # productTypes: ["appliance"] + perPage: 3 + total_pages: -1 + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/meraki/playbooks/devices_live_tools_ping.yml b/ansible_collections/cisco/meraki/playbooks/devices_live_tools_ping.yml new file mode 100644 index 000000000..9276a4cd4 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/devices_live_tools_ping.yml @@ -0,0 +1,31 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Create + cisco.meraki.devices_live_tools_ping: + meraki_suppress_logging: true + # meraki_base_url: "{{meraki_base_url}}" + # meraki_single_request_timeout: "{{meraki_single_request_timeout}}" + # meraki_certificate_path: "{{meraki_certificate_path}}" + # meraki_requests_proxy: "{{meraki_requests_proxy}}" + # meraki_wait_on_rate_limit: "{{meraki_wait_on_rate_limit}}" + # meraki_nginx_429_retry_wait_time: "{{meraki_nginx_429_retry_wait_time}}" + # meraki_action_batch_retry_wait_time: "{{meraki_action_batch_retry_wait_time}}" + # meraki_retry_4xx_error: "{{meraki_retry_4xx_error}}" + # meraki_retry_4xx_error_wait_time: "{{meraki_retry_4xx_error_wait_time}}" + # meraki_maximum_retries: "{{meraki_maximum_retries}}" + # meraki_output_log: "{{meraki_output_log}}" + # meraki_log_file_prefix: "{{meraki_log_file_prefix}}" + # meraki_log_path: "{{meraki_log_path}}" + # meraki_print_console: "{{meraki_print_console}}" + # meraki_suppress_logging: "{{meraki_suppress_logging}}" + # meraki_simulate: "{{meraki_simulate}}" + # meraki_be_geo_id: "{{meraki_be_geo_id}}" + # + # meraki_use_iterator_for_get_pages: "{{meraki_use_iterator_for_get_pages}}" + # meraki_inherit_logging_config: "{{meraki_inherit_logging_config}}" + state: present + count: 2 + serial: QBSD-36C3-473D + target: 75.75.75.75 diff --git a/ansible_collections/cisco/meraki/playbooks/devices_switch_routing_interfaces.yml b/ansible_collections/cisco/meraki/playbooks/devices_switch_routing_interfaces.yml new file mode 100644 index 000000000..2163ea214 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/devices_switch_routing_interfaces.yml @@ -0,0 +1,27 @@ +- hosts: localhost + gather_facts: false + tasks: + - name: Create + cisco.meraki.devices_switch_routing_interfaces: + meraki_suppress_logging: true + state: present + defaultGateway: 192.168.1.1 + interfaceIp: 192.168.1.2 + # ipv6: + # address: 1:2:3:4::1 + # assignmentMode: static + # gateway: 1:2:3:4::2 + # prefix: 1:2:3:4::/48 + # multicastRouting: disabled + name: L3 interface + # ospfSettings: + # area: '0' + # cost: 1 + # isPassiveEnabled: true + # ospfV3: + # area: '1' + # cost: 2 + # isPassiveEnabled: true + serial: L_828099381482770866 + # subnet: 192.168.1.0/24 + # vlanId: 100
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/files/test.template b/ansible_collections/cisco/meraki/playbooks/files/test.template new file mode 100644 index 000000000..cb5641702 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/files/test.template @@ -0,0 +1,35 @@ +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. diff --git a/ansible_collections/cisco/meraki/playbooks/hosts b/ansible_collections/cisco/meraki/playbooks/hosts new file mode 100644 index 000000000..1a26b04da --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/hosts @@ -0,0 +1,2 @@ +[meraki_servers] +meraki_server
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/ms_playbook.yml b/ansible_collections/cisco/meraki/playbooks/ms_playbook.yml new file mode 100644 index 000000000..c9f2d333b --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/ms_playbook.yml @@ -0,0 +1,66 @@ +--- + +- hosts: localhost + vars: + network_id: L_828099381482770866 # Site-2 + serial_number: QBSB-D5ZD-9CXT + gather_facts: false + tasks: + + - name: Update STP settings + cisco.meraki.networks_switch_stp: + networkId: "{{ network_id }}" + rstpEnabled: true + stpBridgePriority: + - stpPriority: 4096 + switches: + - "{{ serial_number }}" + + - name: Update switch settings + cisco.meraki.networks_switch_settings: + networkId: "{{ network_id }}" + useCombinedPower: true + vlan: 1 + + - name: Update storm-control settings + cisco.meraki.networks_switch_storm_control: + networkId: "{{ network_id }}" + broadcastThreshold: 30 + multicastThreshold: 30 + unknownUnicastThreshold: 30 + + - name: Update MTU settings + cisco.meraki.networks_switch_mtu: + networkId: "{{ network_id }}" + defaultMtuSize: 9578 + + - name: Createa a routing interface + cisco.meraki.devices_switch_routing_interfaces: + defaultGateway: 192.168.1.1 + interfaceIp: 192.168.1.2 + name: L3 interface + serial: "{{ serial_number }}" + subnet: 192.168.1.0/24 + vlanId: 123 + + - name: Create a static route + cisco.meraki.devices_switch_routing_static_routes: + serial: "{{ serial_number }}" + name: My route + nextHopIp: 192.168.1.100 + subnet: 1.2.3.0/24 + + - name: Create a static route + cisco.meraki.devices_switch_routing_static_routes: + serial: "{{ serial_number }}" + name: My route + nextHopIp: 192.168.1.100 + subnet: 1.2.3.0/24 + + - name: Port cycle + cisco.meraki.devices_switch_ports_cycle: + serial: "{{ serial_number }}" + ports: + - 1 + - "4-5" + - "25-48" diff --git a/ansible_collections/cisco/meraki/playbooks/mv_playbook.yml b/ansible_collections/cisco/meraki/playbooks/mv_playbook.yml new file mode 100644 index 000000000..78d8c07ba --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/mv_playbook.yml @@ -0,0 +1,63 @@ +--- + +- hosts: localhost + vars: + serial_number: QBSD-8VXX-6QXX + network_id: L_828099381482770866 # Site-2 + gather_facts: false + tasks: + + - name: Update Camera name + cisco.meraki.devices: + serial: "{{ serial_number }}" + name: My Camera + + - name: Update Camera video settings + cisco.meraki.devices_camera_video_settings: + serial: "{{ serial_number }}" + externalRtspEnabled: true + + - name: Create a primary wireless profile + cisco.meraki.networks_camera_wireless_profiles: + networkId: "{{ network_id }}" + name: wireless profile A + ssid: + name: cameras ssid + authMode: psk + encryptionMode: wpa + psk: SuperSecretPreSharedKey + register: primary_profile + + - name: Create a secondary wireless profile + cisco.meraki.networks_camera_wireless_profiles: + networkId: "{{ network_id }}" + name: wireless profile B + ssid: + name: cameras ssid 2 + authMode: psk + encryptionMode: wpa + psk: SuperSecretPreSharedKey + register: secondary_profile + + - name: Associate the camera with the wireless profile + cisco.meraki.devices_camera_wireless_profiles: + serial: "{{ serial_number }}" + ids: + primary: "{{ primary_profile['meraki_response']['id'] }}" + secondary: "{{ secondary_profile['meraki_response']['id'] }}" + + - name: Update quality and retention settings + cisco.meraki.devices_camera_quality_and_retention: + serial: "{{ serial_number }}" + audioRecordingEnabled: true + motionBasedRetentionEnabled: true + motionDetectorVersion: 2 + quality: High + resolution: 1920x1080 + restrictedBandwidthModeEnabled: false + + # - name: Generate a snapshop + # cisco.meraki.devices_camera_generate_snapshot: + # serial: "{{ serial_number }}" + # fullframe: false + # timestamp: '2023-08-08T15:18:08Z'
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/mx_deployment.yml b/ansible_collections/cisco/meraki/playbooks/mx_deployment.yml new file mode 100644 index 000000000..a4f64e8ba --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/mx_deployment.yml @@ -0,0 +1,106 @@ +--- + +- hosts: localhost + vars: + network_id: "L_828099381482771185" # Branch-1234 + gather_facts: false + tasks: + # - name: Get all networks _appliance _vlans + # cisco.meraki.networks_appliance_vlans_info: + # networkId: "{{network_id}}" + # register: result + + - name: Enable Vlans on the MX + cisco.meraki.networks_appliance_vlans_settings: + state: present + networkId: "{{network_id}}" + vlansEnabled: true + + - name: Update appliance Vlans + cisco.meraki.networks_appliance_vlans: + state: present + applianceIp: 192.168.1.2 + cidr: 192.168.1.0/24 + id: '1234' + name: My VLAN + networkId: "{{network_id}}" + subnet: 192.168.1.0/24 + + - name: Update appliance SSID + cisco.meraki.networks_appliance_ssids: + state: present + authMode: 8021x-radius + defaultVlanId: 10 + enabled: true + name: My SSID + networkId: "{{network_id}}" + number: 1234 + radiusServers: + - host: 1.2.3.4 + port: 1000 + secret: secret + visible: true + wpaEncryptionMode: WPA2 only + + - name: Update appliance traffic shaping + cisco.meraki.networks_appliance_traffic_shaping: + state: present + globalBandwidthLimits: + limitDown: 5120 + limitUp: 2048 + networkId: "{{network_id}}" + + - name: Update appliance ports + cisco.meraki.networks_appliance_ports: + allowedVlans: "all" + enabled: true + networkId: "{{network_id}}" + portId: "4" + type: "trunk" + vlan: 10 + state: present + + - name: Create FW outbound L3 rules + cisco.meraki.networks_appliance_firewall_l3_firewall_rules: + networkId: "{{network_id}}" + state: present + rules: + - comment: Block internetbadguys.com + destCidr: internetbadguys.com + destPort: any + policy: deny + protocol: any + srcCidr: any + syslogEnabled: false + + - name: Create FW inbound L3 rules + cisco.meraki.networks_appliance_firewall_inbound_firewall_rules: + networkId: "{{network_id}}" + rules: + - comment: Allow HTTP traffic to VLAN 1234 with HTTP servers. + destCidr: VLAN(1234).* + destPort: '80' + policy: allow + protocol: tcp + srcCidr: Any + srcPort: Any + syslogEnabled: false + + - name: Create FW L7 rules + cisco.meraki.networks_appliance_firewall_l7_firewall_rules: + networkId: "{{network_id}}" + rules: + - policy: deny + type: applicationCategory + value: + name: Sports + id: meraki:layer7/category/5 + + - name: Get all networks _appliance _firewall l3firewallrules + cisco.meraki.networks_appliance_firewall_l3_firewall_rules_info: + networkId: "{{network_id}}" + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/meraki/playbooks/network_devices_claim.yml b/ansible_collections/cisco/meraki/playbooks/network_devices_claim.yml new file mode 100644 index 000000000..757a0a20d --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/network_devices_claim.yml @@ -0,0 +1,11 @@ +- hosts: localhost + vars: + network_id: "L_828099381482771185" # Branch-1234 + gather_facts: false + tasks: + - name: Create + cisco.meraki.networks_devices_claim: + meraki_output_log: true + networkId: "{{network_id}}" + serials: + - QBSD-WABS-BH7V
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/networks.yml b/ansible_collections/cisco/meraki/playbooks/networks.yml new file mode 100644 index 000000000..8cf0077f8 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/networks.yml @@ -0,0 +1,68 @@ +--- +# - hosts: localhost +# gather_facts: false +# tasks: +# - name: Get all networks +# cisco.meraki.networks_info: +# # configTemplateId: string +# # isBoundToConfigTemplate: True +# # tags: [] +# # tagsFilterType: string +# # perPage: 0 +# # startingAfter: string +# # endingBefore: string +# organizationId: "828099381482762270" +# register: result +# - name: Get all networks2 +# cisco.meraki.networks_clients_info: +# # configTemplateId: string +# # isBoundToConfigTemplate: True +# # tags: [] +# # tagsFilterType: string +# # perPage: 0 +# # startingAfter: string +# # endingBefore: string +# # organizationId: "828099381482762270" +# networkId: "{{item.id}}" +# loop: "{{result.meraki_response}}" +# register: result2 + +# - name: Show result +# ansible.builtin.debug: +# msg: "{{ result2 }}" + + + # - name: Create + # cisco.meraki.networks: + # meraki_suppress_logging: true + # state: present + # # copyFromNetworkId: N_24329156 + # name: Site 1 + # notes: Additional description of the network 212 + # organizationId: "828099381482762270" + # productTypes: + # - camera + # - switch + # - wireless + # tags: + # - tag1 + # - tag3 + # timeZone: America/Los_Angeles + +- hosts: localhost + vars: + org_id: 828099381482762270 + gather_facts: false + tasks: + + - name: Createa a new network + cisco.meraki.networks: + meraki_suppress_logging: false + state: present + name: New network by Ansible + notes: Additional description of the network + organizationId: "{{ org_id }}" + productTypes: + - appliance + - switch + timeZone: America/Los_Angeles
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/networks_appliance_vlans.yml b/ansible_collections/cisco/meraki/playbooks/networks_appliance_vlans.yml new file mode 100644 index 000000000..2b45e3d65 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/networks_appliance_vlans.yml @@ -0,0 +1,29 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Create + cisco.meraki.networks_appliance_vlans: + meraki_suppress_logging: true + state: present + applianceIp: 192.168.1.2 + cidr: 192.168.1.0/24 + groupPolicyId: '101' + id: '1234' + ipv6: + enabled: true + prefixAssignments: + - autonomous: false + origin: + interfaces: + - wan0 + type: internet + staticApplianceIp6: 2001:db8:3c4d:15::1 + staticPrefix: 2001:db8:3c4d:15::/64 + mandatoryDhcp: + enabled: true + mask: 28 + name: My VLAN + networkId: L_828099381482770865 + subnet: 192.168.1.0/24 + templateVlanType: same
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/networks_devices_remove.yml b/ansible_collections/cisco/meraki/playbooks/networks_devices_remove.yml new file mode 100644 index 000000000..5fef8d71a --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/networks_devices_remove.yml @@ -0,0 +1,9 @@ +- hosts: localhost + vars: + network_id: "L_828099381482771185" # Branch-1234 + gather_facts: false + tasks: + - name: Create + cisco.meraki.networks_devices_remove: + networkId: L_828099381482771185 + serial: QBSD-WABS-BH7V
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/networks_wireless_ssids_identityPsks.yml b/ansible_collections/cisco/meraki/playbooks/networks_wireless_ssids_identityPsks.yml new file mode 100644 index 000000000..f5dfabb77 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/networks_wireless_ssids_identityPsks.yml @@ -0,0 +1,15 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Create + cisco.meraki.networks_wireless_ssids_identity_psks: + meraki_suppress_logging: true + state: present + expiresAt: '2018-02-11T00:00:00.090210Z' + groupPolicyId: '101' + id: '1284392014819' + name: Sample Identity PSK + networkId: string + number: string + passphrase: secret diff --git a/ansible_collections/cisco/meraki/playbooks/old_collection_test.yml b/ansible_collections/cisco/meraki/playbooks/old_collection_test.yml new file mode 100644 index 000000000..aa72eea43 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/old_collection_test.yml @@ -0,0 +1,40 @@ +- name: Configure Switchports with async API + hosts: localhost + connection: local + vars: + sn: Q3EA-239B-ZQV7 + auth_key: <ACB> + org_name: Test Ansible + switchports: + - name: WAN Trunk1 + type: trunk + allowedVlans: "1,2,19,20,50" + + collections: + - cisco.meraki + tasks: + + - name: Configure switchports + meraki_ms_switchport: + auth_key: "{{ auth_key }}" + org_name: "{{ org_name }}" + serial: "{{ sn }}" + number: "{{ ansible_loop.index }}" + name: "{{ item.name }}" + type: "{{ item.type }}" + enabled: "{{ item.enabled | default(omit) }}" + vlan: "{{ item.vlan | default(omit) }}" + allowed_vlans: "{{ omit if item.allowedVlans is undefined else item.allowedVlans.split(',')}}" + voice_vlan: "{{ item.voiceVlan | default(omit) }}" + access_policy_type: "{{ item.accessPolicyType | default(omit) }}" + access_policy_number: "{{ item.accessPolicyNumber | default(omit) }}" + state: present + loop: "{{ switchports }}" + loop_control: + extended: yes + label: "{{ item.name }}" + pause: 0.3 + register: async_results + # async: 120 + # poll: 0 + tags: [always]
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/organization.yml b/ansible_collections/cisco/meraki/playbooks/organization.yml new file mode 100644 index 000000000..271e3ccdf --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organization.yml @@ -0,0 +1,22 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Create + cisco.meraki.organizations: + meraki_suppress_logging: true + # meraki_username: "{{meraki_username}}" + # meraki_password: "{{meraki_password}}" + # meraki_verify: "{{meraki_verify}}" + # meraki_port: "{{meraki_port}}" + # meraki_version: "{{meraki_version}}" + # meraki_debug: "{{meraki_debug}}" + state: present + management: + details: + - name: MSP ID + value: '12345678' + name: Test Ansible + organizationId: "575334852396583071" + api: + enabled: false diff --git a/ansible_collections/cisco/meraki/playbooks/organization_info.yml b/ansible_collections/cisco/meraki/playbooks/organization_info.yml new file mode 100644 index 000000000..79a1cbcb9 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organization_info.yml @@ -0,0 +1,20 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Get all Organizations + cisco.meraki.organizations_info: + meraki_suppress_logging: false + # meraki_username: "{{meraki_username}}" + # meraki_password: "{{meraki_password}}" + # meraki_verify: "{{meraki_verify}}" + # meraki_port: "{{meraki_port}}" + # meraki_version: "{{meraki_version}}" + # meraki_debug: "{{meraki_debug}}" + # headers: "{{my_headers | from_json}}" + organizationId: "828099381482762766" + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/meraki/playbooks/organization_summary.yml b/ansible_collections/cisco/meraki/playbooks/organization_summary.yml new file mode 100644 index 000000000..94893b68a --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organization_summary.yml @@ -0,0 +1,70 @@ +--- + +- hosts: localhost + vars: + org_id: "828099381482762270" + gather_facts: false + tasks: + + - name: Get all organizations summary top appliances by utilization + cisco.meraki.organizations_summary_top_appliances_by_utilization_info: + organizationId: "{{ org_id }}" + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" + + - name: Get all organizations summary top clients by usage + cisco.meraki.organizations_summary_top_clients_by_usage_info: + organizationId: "{{ org_id }}" + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" + + - name: Get all organizations summary top clients by manufacturers + cisco.meraki.organizations_summary_top_clients_manufacturers_by_usage_info: + organizationId: "{{ org_id }}" + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" + + - name: Get all organizations summary top devices by usage + cisco.meraki.organizations_summary_top_devices_by_usage_info: + organizationId: "{{ org_id }}" + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" + + - name: Get all organizations summary top devices by models + cisco.meraki.organizations_summary_top_devices_models_by_usage_info: + organizationId: "{{ org_id }}" + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" + + - name: Get all organizations summary top SSIDs by usage + cisco.meraki.organizations_summary_top_ssids_by_usage_info: + organizationId: "{{ org_id }}" + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" + + - name: Get all organizations summary top switches by energy usage + cisco.meraki.organizations_summary_top_switches_by_energy_usage_info: + organizationId: "{{ org_id }}" + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/meraki/playbooks/organizations_adaptivePolicy_acls.yml b/ansible_collections/cisco/meraki/playbooks/organizations_adaptivePolicy_acls.yml new file mode 100644 index 000000000..4af3a6cb7 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organizations_adaptivePolicy_acls.yml @@ -0,0 +1,17 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Create + cisco.meraki.organizations_adaptive_policy_acls: + meraki_suppress_logging: true + state: present + description: Blocks sensitive web traffic 2 + ipVersion: ipv6 + name: Block sensitive web traffic + organizationId: "828099381482762270" + rules: + - dstPort: 22-30 + policy: deny + protocol: tcp + srcPort: 1,33 diff --git a/ansible_collections/cisco/meraki/playbooks/organizations_adaptive_policy_groups.yml b/ansible_collections/cisco/meraki/playbooks/organizations_adaptive_policy_groups.yml new file mode 100644 index 000000000..39abc8dbb --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organizations_adaptive_policy_groups.yml @@ -0,0 +1,17 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Create + cisco.meraki.organizations_adaptive_policy_groups: + meraki_suppress_logging: true + state: present + # description: Group of XYZ Corp Employees + # isDefaultGroup: false + name: Employee Group + organizationId: "828099381482762270" + # policyObjects: + # - id: '2345' + # name: Example Policy Object + # requiredIpMappings: [] + sgt: 10005
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/organizations_admin copy.yml b/ansible_collections/cisco/meraki/playbooks/organizations_admin copy.yml new file mode 100644 index 000000000..3a720877e --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organizations_admin copy.yml @@ -0,0 +1,28 @@ +--- +- hosts: localhost + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Update by id + cisco.meraki.networks_floor_plans: + state: present + bottomLeftCorner: + lat: 12 + lng: 11 + bottomRightCorner: + lat: 9 + lng: 8 + center: + lat: 7 + lng: 1 + floorPlanId: string + imageContents: Q2lzY28gTWVyYWtp.png + name: Test + networkId: L_828099381482770942 + # topLeftCorner: + # lat: 0 + # lng: 0 + # topRightCorner: + # lat: 0 + # lng: 0
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/organizations_admin.yml b/ansible_collections/cisco/meraki/playbooks/organizations_admin.yml new file mode 100644 index 000000000..225707aaf --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organizations_admin.yml @@ -0,0 +1,31 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Create + cisco.meraki.organizations_admins: + meraki_suppress_logging: true + meraki_caller: "test 123" + state: absent + name: DevNet Admin 3455 + email: devnetmerakiadmin23@yopmail.com + authenticationMethod: Email + orgAccess: full + networks: [] + tags: [] + organizationId: "828099381482762270" + # - name: Create + # cisco.meraki.organizations_admins: + # meraki_host: "{{meraki_host}}" + # state: present + # authenticationMethod: Email + # email: miles@meraki.com + # name: Miles Meraki + # networks: + # - access: full + # id: N_24329156 + # orgAccess: none + # organizationId: string + # tags: + # - access: read-only + # tag: west
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/organizations_admin_info.yml b/ansible_collections/cisco/meraki/playbooks/organizations_admin_info.yml new file mode 100644 index 000000000..aa4b46896 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organizations_admin_info.yml @@ -0,0 +1,13 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Get all Organizations Admins + cisco.meraki.organizations_admins_info: + meraki_suppress_logging: true + organizationId: "828099381482762270" + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/meraki/playbooks/organizations_camera_custom_analytics_artifacts.yml b/ansible_collections/cisco/meraki/playbooks/organizations_camera_custom_analytics_artifacts.yml new file mode 100644 index 000000000..8a4b063f5 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organizations_camera_custom_analytics_artifacts.yml @@ -0,0 +1,18 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Create + cisco.meraki.organizations_camera_custom_analytics_artifacts: + meraki_suppress_logging: true + state: present + name: Test Ansible 2 + organizationId: "828099381482762270" + artifactId: "828099381482750058" + # - name: Delete + # cisco.meraki.organizations_camera_custom_analytics_artifacts: + # meraki_api_key: "{{meraki_api_key}}" + # state: absent + # name: Test Ansible + # organizationId: "828099381482762270" + # artifactId: "828099381482750043" diff --git a/ansible_collections/cisco/meraki/playbooks/organizations_clients_search_info.yml b/ansible_collections/cisco/meraki/playbooks/organizations_clients_search_info.yml new file mode 100644 index 000000000..b4e566166 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organizations_clients_search_info.yml @@ -0,0 +1,14 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Get all organizations _clients _search + cisco.meraki.organizations_clients_search_info: + meraki_suppress_logging: true + mac: "4c:c8:a1:01:01:c2" + perPage: 3 + total_pages: -1 + # startingAfter: string + # endingBefore: string + organizationId: "828099381482762270" + register: result
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/organizations_config_templates.yml b/ansible_collections/cisco/meraki/playbooks/organizations_config_templates.yml new file mode 100644 index 000000000..775145b10 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organizations_config_templates.yml @@ -0,0 +1,30 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Create + cisco.meraki.organizations_config_templates: + meraki_suppress_logging: true + state: present + name: "My config template" + organizationId: "828099381482762270" + timeZone: "America/Los_Angeles" + + # - name: Update by id + # cisco.meraki.organizations_config_templates: + # meraki_suppress_logging: true + # state: present + # configTemplateId: string + # name: My config template + # organizationId: "828099381482762270" + # timeZone: America/Los_Angeles + + # - name: Delete by id + # cisco.meraki.organizations_config_templates: + # meraki_suppress_logging: true + # + # meraki_use_iterator_for_get_pages: "{{meraki_use_iterator_for_get_pages}}" + # meraki_inherit_logging_config: "{{meraki_inherit_logging_config}}" + # state: absent + # configTemplateId: "L_828099381482770921" + # organizationId: "828099381482762270" diff --git a/ansible_collections/cisco/meraki/playbooks/organizations_config_templates_info.yml b/ansible_collections/cisco/meraki/playbooks/organizations_config_templates_info.yml new file mode 100644 index 000000000..e0dbe1ce8 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organizations_config_templates_info.yml @@ -0,0 +1,9 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Get all organizations _configtemplates + cisco.meraki.organizations_config_templates_info: + meraki_suppress_logging: true + organizationId: "828099381482762270" + register: result
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/organizations_devices_info.yml b/ansible_collections/cisco/meraki/playbooks/organizations_devices_info.yml new file mode 100644 index 000000000..c5da1af5c --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organizations_devices_info.yml @@ -0,0 +1,27 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Get all organizations _devices + cisco.meraki.organizations_devices_info: + meraki_suppress_logging: true + perPage: 3 + total_pages: -1 + # startingAfter: string + # endingBefore: string + # configurationUpdatedAfter: string + # networkIds: [] + # productTypes: [] + # tags: [] + # tagsFilterType: string + # name: string + # mac: string + # serial: string + # model: string + # macs: [] + # serials: [] + # sensorMetrics: [] + # sensorAlertProfileIds: [] + models: ["MV12N"] + organizationId: "828099381482762270" + register: result
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/organizations_login_security.yml b/ansible_collections/cisco/meraki/playbooks/organizations_login_security.yml new file mode 100644 index 000000000..4b211dc8d --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organizations_login_security.yml @@ -0,0 +1,25 @@ +- hosts: localhost + vars: + vars: + org_id: 828099381482762270 # API TEST + gather_facts: false + tasks: + + - name: Get security login settings + cisco.meraki.organizations_login_security_info: + organizationId: "{{ org_id }}" + register: + result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" + + - name: Update security login settings + cisco.meraki.organizations_login_security: + meraki_suppress_logging: false + organizationId: "{{ org_id }}" + state: present + accountLockoutAttempts: 3 + enforceIdleTimeout: true + enforceTwoFactorAuth: true
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/organizations_saml_idps.yml b/ansible_collections/cisco/meraki/playbooks/organizations_saml_idps.yml new file mode 100644 index 000000000..d56cfc090 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/organizations_saml_idps.yml @@ -0,0 +1,11 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: Create + cisco.meraki.organizations_saml_idps: + meraki_suppress_logging: true + state: present + organizationId: "828099381482762270" + sloLogoutUrl: https://somewhere.com + x509certSha1Fingerprint: 00:11:22:33:44:55:66:77:88:99:00:11:22:33:44:55:66:77:88:99 diff --git a/ansible_collections/cisco/meraki/playbooks/switch_port_config.yml b/ansible_collections/cisco/meraki/playbooks/switch_port_config.yml new file mode 100644 index 000000000..00c43be09 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/switch_port_config.yml @@ -0,0 +1,11 @@ +--- +- hosts: localhost + gather_facts: false + tasks: + - name: update ports + cisco.meraki.devices_switch_ports: + meraki_suppress_logging: true + state: present + serial: "QBSB-D8ED-9NXT" + vlan: 10 + portId: 1
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/test.yml b/ansible_collections/cisco/meraki/playbooks/test.yml new file mode 100644 index 000000000..02e2c7cd9 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/test.yml @@ -0,0 +1,135 @@ +--- + +- hosts: localhost + vars: + network_id: "L_828099381482771185" # Branch-1234 + org_id: "828099381482762270" + gather_facts: false + tasks: + + # - name: Get all networks _appliance _ports + # cisco.meraki.networks_appliance_ports_info: + # networkId: L_828099381482771185 + # register: result + # - name: update port + # cisco.meraki.devices_switch_ports: + # meraki_suppress_logging: false + # serial: QBSB-BNH2-KDXJ + # portId: 3 + # vlan: 50 + # # type: access + # state: present + # poeEnabled: false + # - name: Update appliance Vlans + # cisco.meraki.networks_appliance_vlans: + # state: present + # applianceIp: 192.168.1.2 + # cidr: 192.168.1.0/24 + # id: '1234' + # name: My VLAN + # networkId: "{{network_id}}" + # subnet: 192.168.1.0/24 + + # - name: Get all networks _appliance _ssids + # cisco.meraki.networks_appliance_ssids_info: + # networkId: "{{network_id}}" + # register: result + + # - name: Show result + # ansible.builtin.debug: + # msg: "{{ result }}" + + # - name: Update appliance SSID + # cisco.meraki.networks_appliance_ssids: + # state: present + # authMode: 8021x-radius + # defaultVlanId: 10 + # enabled: true + # name: My SSID + # networkId: "{{network_id}}" + # number: 1 + # radiusServers: + # - host: 1.2.3.4 + # port: 1000 + # secret: secret + # visible: true + # wpaEncryptionMode: WPA2 only + + +# ################################################################ + + # - name: Update appliance traffic sharping + # cisco.meraki.networks_appliance_traffic_shaping: + # state: present + # globalBandwidthLimits: + # limitDown: 5120 + # limitUp: 2048 + # networkId: "{{network_id}}" + + # - name: Enable Vlans on the MX + # cisco.meraki.networks_appliance_vlans_settings: + # state: present + # networkId: "{{network_id}}" + # vlansEnabled: true + + # - name: Update appliance ports + # cisco.meraki.networks_appliance_ports: + # accessPolicy: "open" + # allowedVlans: "all" + # enabled: true + # networkId: "{{network_id}}" + # portId: "2" + # type: "trunk" + # vlan: 10 + # state: present + # - name: Get all networks + # cisco.meraki.networks_info: + # organizationId: "{{org_id}}" + # total_pages: -1 + # direction: next + # register: result + + # - name: Show result + # ansible.builtin.debug: + # msg: "{{ result.meraki_response[0].id }}" + + # - name: Bind a template from a network + # meraki_config_template: + # auth_key: "{{ meraki_api_key }}" + # state: present + # org_id: "{{ org_name }}" + # net_id: "{{ off_network.results.0.meraki_response.id }}" + # config_template: "{{ item.value.template_name }}" + # delegate_to: localhost + # loop: "{{ lookup('dict', devices) }}" + + + # - name: Create + # cisco.meraki.organizations_config_templates: + # # meraki_api_key: "{{meraki_api_key}}" + # state: present + # name: My config template + # organizationId: "{{ org_id }}" + # register: result + + # - name: Create + # cisco.meraki.networks_bind: + # autoBind: false + # configTemplateId: "{{result.meraki_response.id}}" + # networkId: "{{network_id}}" + + + # - name: change name of device + # cisco.meraki.devices: + # name: new name 4 + # serial: QBSB-D5ZD-9CXT + # # organizationId: "{{org_id}}" + # state: present + # meraki_suppress_logging: false + + - name: onboard order + cisco.meraki.organizations_inventory_claim: + # meraki_api_key: "{{ meraki_api }}" + # meraki_simulate: "{{ testpolicy }}" + organizationId: "{{ org_id }}" + orders: "1"
\ No newline at end of file diff --git a/ansible_collections/cisco/meraki/playbooks/who_am_i.yml b/ansible_collections/cisco/meraki/playbooks/who_am_i.yml new file mode 100644 index 000000000..c6f5acb30 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/who_am_i.yml @@ -0,0 +1,11 @@ +--- +- hosts: meraki_servers + gather_facts: false + tasks: + - name: Get my administered identities + cisco.meraki.administered_identities_me_info: + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/meraki/playbooks/wifi_deploy_one.yml b/ansible_collections/cisco/meraki/playbooks/wifi_deploy_one.yml new file mode 100644 index 000000000..4047c9085 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/wifi_deploy_one.yml @@ -0,0 +1,18 @@ +--- + +- hosts: localhost + vars: + org_id: "828099381482762270" + corp_name: "ACME" + network_id: "L_828099381482770865" + gather_facts: false + tasks: + + - name: Create corporate SSID + cisco.meraki.networks_wireless_ssids: + meraki_suppress_logging: true + state: present + enabled: true + name: "{{corp_name}}" + networkId: "{{ network_id }}" + number: "1" diff --git a/ansible_collections/cisco/meraki/playbooks/wifi_deployment.yml b/ansible_collections/cisco/meraki/playbooks/wifi_deployment.yml new file mode 100644 index 000000000..80314a1c1 --- /dev/null +++ b/ansible_collections/cisco/meraki/playbooks/wifi_deployment.yml @@ -0,0 +1,79 @@ +--- +# This playbook will create 3 WiFi networks across all networks in a given Meraki organization: +# 1. Corporate (802.1x) on vlan 100 +# 2. Mobile (WPA-PSK) on vlan 200 +# 3. Guests (Portal) on vlan 300 + +- hosts: localhost + vars_files: + - credentials.yml + vars: + org_id: "828099381482762270" + corp_name: "Umbrella Corp" + gather_facts: false + tasks: + + - name: Get Organization Networks + cisco.meraki.networks_info: + organizationId: "{{ org_id }}" + register: result + + - name: Filter networks with "wireless" productTypes + set_fact: + filtered_networks: "{{ result.meraki_response | selectattr('productTypes', 'contains', 'wireless') | list }}" + + - name: Create corporate SSID + cisco.meraki.networks_wireless_ssids: + state: present + enabled: true + name: "{{corp_name}}" + networkId: "{{ item.id }}" + number: 1 + ipAssignmentMode: Bridge mode + defaultVlanId: 100 + useVlanTagging: true + authMode: "8021x-radius" + radiusServers: + - one: + host: "1.2.3.4" + port: 1812 + secret: SuperSecretPassword + + loop: "{{ filtered_networks }}" + loop_control: + label: "{{ item.id }}" + + - name: Create Mobile/PSK SSID + cisco.meraki.networks_wireless_ssids: + state: present + enabled: true + name: "{{corp_name}}-legacy" + networkId: "{{ item.id }}" + number: 2 + ipAssignmentMode: Bridge mode + defaultVlanId: 200 + useVlanTagging: true + authMode: psk + encryptionMode: wpa + psk: SuperSecretPreSharedKey + + loop: "{{ filtered_networks }}" + loop_control: + label: "{{ item.id }}" + + - name: Create Guest SSID + cisco.meraki.networks_wireless_ssids: + state: present + enabled: true + name: "{{corp_name}}-Guests" + networkId: "{{ item.id }}" + number: 3 + ipAssignmentMode: Bridge mode + defaultVlanId: 300 + useVlanTagging: true + authMode: "open" + splashPage: Click-through splash page + + loop: "{{ filtered_networks }}" + loop_control: + label: "{{ item.id }}" |