I have to apply the following configuration on several hosts via Ansible:
nmcli device modify "device_name" ens192 ipv6.method "disabled"
I wanted to use the nmcli module instead of a command as it is cleaner. But from what I found on the documentation and forums the nmcli module manage only connections.
Apart from recovering all connections associated to an interface and modifying each one using Ansible nmcli module I could not find a way to do it. This solution beeing, in my opinion, uglier than using command module I will stick with command.
Any informed comment or suggestion would be appreciated.
For the sake of precision the current code used to disable ipv6 if networkmanager is used:
- name: get service facts
service_facts:
- name: Disable ipv6 with network manager
become: yes
command: "/bin/nmcli device modify {{ ansible_default_ipv4.interface }} ipv6.method 'disabled'"
when: ansible_facts.services["NetworkManager.service"] is defined
changed_when: false
I am not sure if I understand your question fully since there is no example what you have tried, problem description, description of your system, used versions, confguration or error messages.
Regarding
and according the documentation of the module
nmclithere is a parameterifnameSo looking at the CLI output of
nmcli device showand since
conn_nameobviously points toGENERAL.CONNECTION, wouldn't that parameterifnameforGENERAL.DEVICEnot be that one which you are looking for?The Examples are showing also the usage of
ifnametogether withconn_name.Furthermore
ipv6.method disabledisn't available in example in RHEL 7, but as of 8.