I have the following module invocation:
- name: Create port-channels on the ToR(s)
nxos_portchannel:
host: “{{ item.switch }}”
transport: cli
group: “{{ item.interface | regex_replace(‘[1]+([0-9]+)$’, ‘\1’) }}”
members: “{{ item.port_list }}”
mode: “{{ item.mode | default(‘active’) }}”
state: present
force: true
with_items: “{{ port_data | default() }}”
when: item.port_list is defined
register: command_result
When I run the playbook, it thinks the port-channel is already there:
TASK [Create port-channels on the ToR(s)] **************************************
ok: [localhost] => (item={u’switch’: u’csn-sjc18-n9k3.ciscolabs.net’, u’port_list’: [u’Eth1/32’], u’vpc’: 32, u’interface’: u’Port-channel32’, u’port_profile’: u’rhev-host’, u’desc’: u’rhev1.rhat’})
But it is not:
csn-sjc18-n9k3# show port-channel summary
1 Po1(SU) Eth NONE Eth2/12(P)
2 Po2(SU) Eth LACP Eth2/1(P)
3 Po3(SU) Eth LACP Eth1/1(P) Eth1/2(P)
4 Po4(SU) Eth LACP Eth1/3(P) Eth1/4(P)
5 Po5(SU) Eth LACP Eth1/5(P)
6 Po6(SU) Eth LACP Eth1/6(P)
7 Po7(SU) Eth LACP Eth1/7(P)
300 Po300(SU) Eth NONE Eth1/45(P) Eth1/46(P)
The results has a “proposed” section, but no “updates” sections. Does that mean Ansible thinks it needs to make a change, but doesn’t actually make it?
“results”: [
{
“_ansible_item_result”: true,
“_ansible_no_log”: false,
“_ansible_parsed”: true,
“changed”: false,
“end_state”: {},
“existing”: {},
“invocation”: {
“module_args”: {
“auth_pass”: null,
“authorize”: false,
“config”: null,
“force”: “true”,
“group”: “32”,
“host”: “csn-sjc18-n9k3.ciscolabs.net”,
“include_defaults”: “False”,
“members”: [
“Eth1/32”
],
“min_links”: null,
“mode”: “active”,
“password”: null,
“port”: null,
“provider”: null,
“save”: false,
“ssh_keyfile”: null,
“state”: “present”,
“timeout”: 10,
“transport”: “cli”,
“use_ssl”: false,
“username”: null,
“validate_certs”: true
},
“module_name”: “nxos_portchannel”
},
“item”: {
“desc”: “rhev1.rhat”,
“interface”: “Port-channel32”,
“port_list”: [
“Eth1/32”
],
“port_profile”: “rhev-host”,
“switch”: “csn-sjc18-n9k3.ciscolabs.net”,
“vpc”: 32
},
“proposed”: {
“group”: “32”,
“members”: [
“Eth1/32”
],
“mode”: “active”
},
“updates”:
},
Thanks,
Steven.
^0-9 ↩︎