ansible-meraki
ansible-meraki copied to clipboard
[cisco.meraki.meraki_switchport] Cannot change type from `"type": "access"` to `"type": "open"`.
Hello!
I saw when I set the "type": "access"
I cannot change the "type": "open"
. I resolve it via GUI (manually change it in the port configuration) So I think it is a bug :D
TASK [Configure port SW_E0_10_3/46] ***************************************************************************************************************************************************
task path: /home/yorune/repo/wtt-infrastructure-meraki/playbooks/SW_E0_10.yml:1831
redirecting (type: modules) cisco.meraki.meraki_switchport to cisco.meraki.meraki_ms_switchport
ok: [localhost] => {"changed": false, "data": {"access_policy_number": 2, "access_policy_type": "Custom access policy", "allowed_vlans": "1,15,1055,1730", "enabled": true, "isolation_enabled": false, "link_negotiation": "Auto negotiate", "link_negotiation_capabilities": ["Auto negotiate", "1 Gigabit full duplex (forced)", "100 Megabit (auto)", "100 Megabit full duplex (forced)", "10 Megabit (auto)", "10 Megabit full duplex (forced)"], "name": "E1_AP_TEST", "poe_enabled": true, "port_id": "46", "port_schedule_id": null, "rstp_enabled": true, "stp_guard": "disabled", "tags": [], "type": "access", "udld": "Alert only", "vlan": 1, "voice_vlan": null}, "response": "OK (unknown bytes)", "status": 200}
TASK [Configure port SW_E0_10_3/46] ***************************************************************************************************************************************************
task path: /home/yorune/repo/wtt-infrastructure-meraki/playbooks/SW_E0_10.yml:1838
redirecting (type: modules) cisco.meraki.meraki_switchport to cisco.meraki.meraki_ms_switchport
fatal: [localhost]: FAILED! => {"changed": false, "msg": "HTTP error 400 - https://api.meraki.com/api/v1/devices/Q2YP-7MNT-ZMH3/switch/ports/46 - Trunk ports do not support user-defined Access Policies", "response": "OK (unknown bytes)", "status": 400}
Vars:
- AP_TYPE: trunk
- AP_POE: yes
- AP_ALLOWED_VLANS:
- 1
- 15
- 1055
- 1730
- name: Configure port SW_E0_10_3/46
cisco.meraki.meraki_switchport:
auth_key: "{{ MERAKI_API_KEY }}"
serial: "{{ SERIAL_SW_E0_10_3 }}"
name: "E1_AP_198_TEST"
state: query
number: 46
- name: Configure port SW_E0_10_3/46
cisco.meraki.meraki_switchport:
auth_key: "{{ MERAKI_API_KEY }}"
serial: "{{ SERIAL_SW_E0_10_3 }}"
name: "E1_AP_198_TEST"
state: present
number: 46
type: "{{ AP_TYPE }}"
allowed_vlans: "{{ AP_ALLOWED_VLANS }}"
poe_enabled: "{{ AP_POE }}"
@y0rune Interesting. To confirm, you're not setting any custom access policies correct?
I set the custom access policies as you can see in the yaml code:
[Getting current Configure port SW_E0_10_3/46]
ok: [localhost] => {"changed": false, "data": {"access_policy_number": 2, "access_policy_type": "Custom access policy", "allowed_vlans": "1,15,1055,1730" ... "status": 200}
But in the state: present
I do not set any custom polices.
For example I set the port like this:
After that I would like to change it like was before so I would like to run the playbook with the configuration you saw above.
I'm going to test this further but I want to confirm one detail. I do see your AP_TYPE
variable is set to trunk
which isn't compatible with access policies. Is your intention this port be a trunk port?
Yeah this is my intention. I would like to set it into a trunk port. So I think I should disable policy and after that apply the type trunk. So I believe it can be automated in the ansible :D Thank you for your response.