Description of problem: I tried to configure vlan, and I got the following error. fatal: [192.168.122.215]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "module_stderr": "Shared connection to 192.168.122.215 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/root/.ansible/tmp/ansible-tmp-1562572575.7791524-180821907536373/AnsiballZ_nmcli.py\", line 114, in <module>\r\n _ansiballz_main()\r\n File \"/root/.ansible/tmp/ansible-tmp-1562572575.7791524-180821907536373/AnsiballZ_nmcli.py\", line 106, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/root/.ansible/tmp/ansible-tmp-1562572575.7791524-180821907536373/AnsiballZ_nmcli.py\", line 49, in invoke_module\r\n imp.load_module('__main__', mod, module, MOD_DESC)\r\n File \"/tmp/ansible_nmcli_payload_qP0vS5/__main__.py\", line 1549, in <module>\r\n File \"/tmp/ansible_nmcli_payload_qP0vS5/__main__.py\", line 1527, in main\r\n File \"/tmp/ansible_nmcli_payload_qP0vS5/__main__.py\", line 1425, in modify_connection\r\n File \"/tmp/ansible_nmcli_payload_qP0vS5/__main__.py\", line 682, in execute_command\r\n File \"/tmp/ansible_nmcli_payload_qP0vS5/ansible_nmcli_payload.zip/ansible/module_utils/basic.py\", line 2477, in run_command\r\n File \"/usr/lib64/python2.7/posixpath.py\", line 293, in expandvars\r\n if '$' not in path:\r\nTypeError: argument of type 'int' is not iterable\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1} $ cat vlan_test1.yaml - hosts: targets gather_facts: no remote_user: root tasks: - name: Add Vlan 120 nmcli: type: vlan conn_name: vlan120-eth1 vlanid: 120 vlandev: eth1 ip4: 192.168.140.100/24 state: present The root cause is because vlanid was added into command args array as integer. vlanid is the integer type. It should be changed into a string to make the command args array. The following is my proposed patch. $ gendiff /usr/lib/python3.7/site-packages/ansible/modules/net_tools .original diff -up /usr/lib/python3.7/site-packages/ansible/modules/net_tools/nmcli.py.original /usr/lib/python3.7/site-packages/ansible/modules/net_tools/nmcli.py --- /usr/lib/python3.7/site-packages/ansible/modules/net_tools/nmcli.py.original 2019-07-08 16:51:25.282282730 +0900 +++ /usr/lib/python3.7/site-packages/ansible/modules/net_tools/nmcli.py 2019-07-08 17:48:34.081422730 +0900 @@ -1145,7 +1145,7 @@ class Nmcli(object): cmd.append('vlan%s' % self.vlanid) params = {'dev': self.vlandev, - 'id': self.vlanid, + 'id': str(self.vlanid), 'ip4': self.ip4 or '', 'gw4': self.gw4 or '', 'ip6': self.ip6 or '', @@ -1170,7 +1170,7 @@ class Nmcli(object): cmd.append('vlan%s' % self.vlanid) params = {'vlan.parent': self.vlandev, - 'vlan.id': self.vlanid, + 'vlan.id': str(self.vlanid), 'ipv4.address': self.ip4 or '', 'ipv4.gateway': self.gw4 or '', 'ipv4.dns': self.dns4 or '', Version-Release number of selected component (if applicable): Fedora 30 How reproducible: Always Steps to Reproduce: 1. run a ansible playbook to create a new vlan. See above example. Actual results: ansible-playbook failed Expected results: ansible-playbook doesn't fail. Additional info:
Thanks for the debugging and patch. Would you be willing to file this upstream at https://github.com/ansible/ansible ?
Hi Kevin, OK, I filed it here: https://github.com/ansible/ansible/issues/58949 Thanks!
FEDORA-2019-a9195834a9 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-a9195834a9
FEDORA-2019-5f9a9b20f3 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-5f9a9b20f3
ansible-2.8.6-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-a9195834a9
ansible-2.8.6-1.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-355f9240c5
ansible-2.8.6-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-5f9a9b20f3
FEDORA-2019-355f9240c5 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-355f9240c5
ansible-2.8.6-1.fc30, ansible-lint-4.1.1a0-4.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-a9195834a9
ansible-2.8.6-1.fc31, ansible-lint-4.1.1a0-4.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-355f9240c5
ansible-2.8.6-1.fc29, ansible-lint-4.1.1a0-4.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-5f9a9b20f3
ansible-2.8.6-1.fc31, ansible-lint-4.1.1a0-4.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.
ansible-2.8.6-1.fc29, ansible-lint-4.1.1a0-4.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.