Open ebarrere opened 1 day ago
Not sure if this is an issue with the plugin, or with nmcli itself, but at very least I would think the failure should be returned so the task fails.
nmcli
When trying to add or modify a network with a password longer than 16 characters, I get the error below:
Error: Failed to save 'Network' (ef1a1d2e-6f92-4670-b114-594bf1c8d69e) connection: 802-11-wireless-security.psk: property is invalid
Bug Report
$ ansible --version ansible [core 2.17.4] config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /opt/arcfield/venv/lib/python3.12/site-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /opt/arcfield/venv/bin/ansible python version = 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] (/opt/arcfield/venv/bin/python3) jinja version = 3.1.4 libyaml = True
$ ansible-galaxy collection list community.general # /opt/arcfield/venv/lib/python3.12/site-packages/ansible_collections Collection Version ----------------- ------- community.general 9.4.0
$ ansible-config dump --only-changed CONFIG_FILE() = None
Though I do set these relevant environment variables:
export BASE_PATH="/opt/arcfield" export ANSIBLE_COLLECTIONS_PATH="${BASE_PATH}/linux_configuration/ansible/collections/" export ANSIBLE_ROLES_PATH="${BASE_PATH}/linux_configuration/ansible/roles/"
Ubuntu 24.04.1 LTS
Minimal test case:
- name: Cause the failure community.general.nmcli: type: wifi conn_name: TestNet ssid: TestNet wifi_sec: key-mgmt: wpa-psk psk: "aaaaaaaaaaaaaaaa" state: present
Connection is added/updated with the correct password.
Connection failed to update
TASK [Add TestNet] ************************************************************** task path: /opt/arcfield/linux_configuration/ansible/playbooks/miscellaneous.yml:25 <hostname> ESTABLISH LOCAL CONNECTION FOR USER: root <hostname> EXEC /bin/sh -c 'echo ~root && sleep 0' <hostname> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1730397876.7376566-28037-248146139678435 `" && echo ansible-tmp-1730397876.7376566-28037-248146139678435="` echo /root/.ansible/tmp/ansible-tmp-1730397876.7376566-28037-248146139678435 `" ) && sleep 0' Using module file /opt/arcfield/linux_configuration/ansible/collections/ansible_collections/community/general/plugins/modules/nmcli.py <hostname> PUT /root/.ansible/tmp/ansible-local-273526dti1z0o/tmp7upiglbo TO /root/.ansible/tmp/ansible-tmp-1730397876.7376566-28037-248146139678435/AnsiballZ_nmcli.py <hostname> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1730397876.7376566-28037-248146139678435/ /root/.ansible/tmp/ansible-tmp-1730397876.7376566-28037-248146139678435/AnsiballZ_nmcli.py && sleep 0' <hostname> EXEC /bin/sh -c '/opt/arcfield/venv/bin/python3.12 /root/.ansible/tmp/ansible-tmp-1730397876.7376566-28037-248146139678435/AnsiballZ_nmcli.py && sleep 0' <hostname> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1730397876.7376566-28037-248146139678435/ > /dev/null 2>&1 && sleep 0' changed: [hostname] => { "Exists": "Connections do exist so we are modifying them", "changed": true, "conn_name": "TestNet", "invocation": { "module_args": { "addr_gen_mode6": null, "ageingtime": 300, "arp_interval": null, "arp_ip_target": null, "autoconnect": true, "conn_name": "TestNet", "dhcp_client_id": null, "dns4": null, "dns4_ignore_auto": false, "dns4_options": null, "dns4_search": null, "dns6": null, "dns6_ignore_auto": false, "dns6_options": null, "dns6_search": null, "downdelay": null, "egress": null, "flags": null, "forwarddelay": 15, "gsm": null, "gw4": null, "gw4_ignore_auto": false, "gw6": null, "gw6_ignore_auto": false, "hairpin": false, "hellotime": 2, "ifname": "wlp0s20f3", "ignore_unsupported_suboptions": false, "ingress": null, "ip4": null, "ip6": null, "ip_privacy6": null, "ip_tunnel_dev": null, "ip_tunnel_input_key": null, "ip_tunnel_local": null, "ip_tunnel_output_key": null, "ip_tunnel_remote": null, "mac": null, "macvlan": null, "master": null, "maxage": 20, "may_fail4": true, "method4": null, "method6": null, "miimon": null, "mode": "balance-rr", "mtu": null, "never_default4": false, "path_cost": 100, "primary": null, "priority": 128, "route_metric4": null, "route_metric6": null, "routes4": null, "routes4_extended": null, "routes6": null, "routes6_extended": null, "routing_rules4": null, "runner": "roundrobin", "runner_fast_rate": null, "runner_hwaddr_policy": null, "slave_type": null, "slavepriority": 32, "ssid": "TestNet", "state": "present", "stp": true, "transport_mode": null, "type": "wifi", "updelay": null, "vlandev": null, "vlanid": null, "vpn": null, "vxlan_id": null, "vxlan_local": null, "vxlan_remote": null, "wifi": null, "wifi_sec": { "key-mgmt": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "psk": { "changed": false, "failed": false, "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER" } }, "wireguard": null, "xmit_hash_policy": null, "zone": null } }, "state": "present", "stdout": "\n===| nmcli interactive connection editor |===\n\nEditing existing '802-11-wireless' connection: 'TestNet'\n\nType 'help' or '?' for available commands.\nType 'print' to show all the connection properties.\nType 'describe [<setting>.<prop>]' for detailed property description.\n\nYou may edit the following settings: connection, 802-11-wireless (wifi), 802-11-wireless-security (wifi-sec), 802-1x, ethtool, match, ipv4, ipv6, hostname, link, tc, proxy\nnmcli> set 802-11-wireless-security.psk {'value': '********', 'failed': F\rFalse, 'changed': False}\nnmcli> save\nError: Failed to save 'TestNet' (ef1a1d2e-6f92-4670-b114-594bf1c8d69e) connection: 802-11-wireless-security.psk: property is invalid\nnmcli> quit\n", "stdout_lines": [ "", "===| nmcli interactive connection editor |===", "", "Editing existing '802-11-wireless' connection: 'TestNet'", "", "Type 'help' or '?' for available commands.", "Type 'print' to show all the connection properties.", "Type 'describe [<setting>.<prop>]' for detailed property description.", "", "You may edit the following settings: connection, 802-11-wireless (wifi), 802-11-wireless-security (wifi-sec), 802-1x, ethtool, match, ipv4, ipv6, hostname, link, tc, proxy", "nmcli> set 802-11-wireless-security.psk {'value': '********', 'failed': F", "False, 'changed': False}", "nmcli> save", "Error: Failed to save 'TestNet' (ef1a1d2e-6f92-4670-b114-594bf1c8d69e) connection: 802-11-wireless-security.psk: property is invalid", "nmcli> quit" ] }
Files identified in the description:
plugins/modules/nmcli.py
If these files are incorrect, please update the component name section of the description or use the !component bot command.
component name
!component
click here for bot help
cc @alcamie101 click here for bot help
Summary
Not sure if this is an issue with the plugin, or with
nmcli
itself, but at very least I would think the failure should be returned so the task fails.When trying to add or modify a network with a password longer than 16 characters, I get the error below:
Issue Type
Bug Report
Component Name
nmcli
Ansible Version
Community.general Version
Configuration
Though I do set these relevant environment variables:
OS / Environment
Ubuntu 24.04.1 LTS
Steps to Reproduce
Minimal test case:
Expected Results
Connection is added/updated with the correct password.
Actual Results
Connection failed to update
Code of Conduct