Community.general.nmcli FAILED on RHEL8, works on RHEL9

I have this snippet:-

- name: nmcli eth0 ipv4 dns-search "subdomain.domain.tld"
    community.general.nmcli:
      conn_name: eth0
      dns4_search: subdomain.domain.tld
      state: present

which works find on my RHEL9 target client, but the RHEL8 target client reports:-

fatal: [hostname]: FAILED! => {"changed": false, "msg": "Error: bad connection type: 'None' not among [6lowpan, 802-11-olpc-mesh (olpc-mesh), 802-11-wireless (wifi), 802-3-ethernet (ethernet), adsl, bluetooth, bond, bridge, cdma, dummy, generic, gsm, infiniband, ip-tunnel, macsec, macvlan, ovs-bridge, ovs-dpdk, ovs-interface, ovs-patch, ovs-port, pppoe, team, tun, veth, vlan, vpn, vrf, vxlan, wifi-p2p, wimax, wireguard, wpan, bond-slave, bridge-slave, team-slave]\n", "name": "eth0", "rc": 2}

eth0 is present, and I can configure the ipv4 dns-search manually on the target machine OK.

I have destroyed and redeployed the target VM but still the same.

any ideas, similar experiences and solutions ?

[dunno why, but the indents have been lost on my snippet, the lines 3-5 should be further indented but have been lost in the paste and I can’t manually indent them here, but indents are there in my yaml]

Hi,

I ran your snippet task on various machines (Debian12, EL8, EL9) using Network Manager and result is the same: type parameter have to be specified if iface doesn’t exist, and I’m guessing that could be your issue ?

[dunno why, but the indents have been lost on my snippet, the lines 3-5 should be further indented but have been lost in the paste and I can’t manually indent them here, but indents are there in my yaml]

AFAIK discourse posts uses markdown so you’d better use code blocks to preserve indentation and such.

Edit: Also pure html and BBCode.

Indeed! I have edited your post (hope you don’t mind!) to add the necessary backticks ``` around the yaml and the log line. Hope that helps!

thanks, Greg, will know for next time, thanks for the update,

yowza, there’s some nice people out there,
great spot, Pierre, you were spot on
type has been specified and confirmed as working as expected now.
[musta been some default improvements in EL9 to accept type unspecified that aren’t there in EL8]
once again, thanks,

Glad it worked @Nesbit7 - if you wouldn’t mind hitting that :white_check_mark: to accept @ptn’s answer, that would be lovely :wink:

already done once I realised that button was there, no prob

You know, I could have sworn i looked before posted, but clearly I did not look properly. Thanks! Hope you’ll stick around :wink: