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