ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
823 stars 1.52k forks source link

nmcli: "Unsupported parameters for (community.general.nmcli) module: device-id #7302

Open m986883511 opened 1 year ago

m986883511 commented 1 year ago

Summary

use nmcli module with param device-id error

Issue Type

Bug Report

Component Name

nmcli

Ansible Version

$ ansible --version
(astute) [root@host162 jmtools]# ansible --version
ansible [core 2.12.10]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/miniconda3/envs/astute/lib/python3.8/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /root/miniconda3/envs/astute/bin/ansible
  python version = 3.8.17 (default, Jul  5 2023, 21:04:15) [GCC 11.2.0]
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
# /root/miniconda3/envs/astute/lib/python3.8/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 4.8.3

Configuration

$ ansible-config dump --only-changed

OS / Environment

(astute) [root@host162 jmtools]# cat /etc/os-release NAME="Rocky Linux" VERSION="9.2 (Blue Onyx)" ID="rocky" ID_LIKE="rhel centos fedora" VERSION_ID="9.2" PLATFORM_ID="platform:el9" PRETTY_NAME="Rocky Linux 9.2 (Blue Onyx)" ANSI_COLOR="0;32" LOGO="fedora-logo-icon" CPE_NAME="cpe:/o:rocky:rocky:9::baseos" HOME_URL="https://rockylinux.org/" BUG_REPORT_URL="https://bugs.rockylinux.org/" SUPPORT_END="2032-05-31" ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9" ROCKY_SUPPORT_PRODUCT_VERSION="9.2" REDHAT_SUPPORT_PRODUCT="Rocky Linux" REDHAT_SUPPORT_PRODUCT_VERSION="9.2"

Steps to Reproduce

(astute) [root@host162 jmtools]# cat nm.yml
---

- name: Clear IP address on a network interface
  hosts: localhost
  become: true
  tasks:

    - name: Clear IP address on the network interface
      nmcli:
        conn_name: manage
        type: ethernet
        state: absent

    - name: set manage
      community.general.nmcli:
        conn_name: manage
        type: ethernet
        device-id: eth0
        state: present
        autoconnect: true
        method4: disabled
        method6: disabled

    - name: Restart the network service
      service:
        name: NetworkManager
        state: restarted

Expected Results

work correct, empty ip on eth0

Actual Results

(astute) [root@host162 jmtools]# ansible-playbook -i localhost, nm.yml --private-key=config/ssh/id_rsa

PLAY [Clear IP address on a network interface] *************************************************************************

TASK [Gathering Facts] *************************************************************************************************
[WARNING]: Platform linux on host localhost is using the discovered Python interpreter at /usr/bin/python3.9, but
future installation of another Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible-core/2.12/reference_appendices/interpreter_discovery.html for more information.
ok: [localhost]

TASK [Clear IP address on the network interface] ***********************************************************************
ok: [localhost]

TASK [set manage] ******************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (community.general.nmcli) module: device-id. Supported parameters include: ip_tunnel_input_key, dns6_ignore_auto, wifi, gw4_ignore_auto, ip_privacy6, ip_tunnel_local, ingress, routes4_extended, gw6, routing_rules4, ageingtime, autoconnect, state, ip_tunnel_remote, updelay, vxlan_remote, dns4_search, ip6, route_metric6, path_cost, ssid, conn_name, method6, ip_tunnel_output_key, wireguard, mac, egress, type, routes4, vxlan_id, arp_interval, gw4, dns4_ignore_auto, route_metric4, master, may_fail4, arp_ip_target, hairpin, maxage, miimon, forwarddelay, vlanid, stp, downdelay, runner_hwaddr_policy, vlandev, mode, routes6_extended, gw6_ignore_auto, slavepriority, primary, gsm, priority, vxlan_local, wifi_sec, method4, ip4, routes6, dns4, dns6, dhcp_client_id, addr_gen_mode6, hellotime, ignore_unsupported_suboptions, zone, never_default4, mtu, ip_tunnel_dev, flags, runner, ifname, dns6_search."}

PLAY RECAP *************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Code of Conduct

m986883511 commented 1 year ago

Is there a simple way to empty all ip on select ethernet?

ansibullbot commented 1 year ago

cc @alcamie101 click here for bot help

russoz commented 1 year ago

hi @m986883511

Thanks for reporting!

Could you please try updating the c.g collection to the latest version (7.5.0)? Version 4.8.3 you reported is too old and no longer supported.