summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/meraki/playbooks/old_collection_test.yml
blob: aa72eea43f0191af497af7c9931c52a34f1c477a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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]