I can create an interface with something like:
- name: create dummy interface
community.general.nmcli:
type: dummy
conn_name: '{{ item.conn_name }}'
ifname: '{{ item.ifname }}'
ip6: '{{ item.ip6 }}'
state: present
with_items:
- '{{ nmcli_dummy }}'
But if in the server I put the interface down: ifconfig dummy0 down
, what parameter or options could be used to manage the interface state, for example up
or down
?
For a connection in example named
eth1
the equivalents forshow
,up
anddown
areWhereby in
nmcli
module are certain Parameters fora parameter for bringing a network interface up or down is not explicit named.
This might leave one to think to workaround it with
as this is almost what the module code is doing under the hood.
However, according the NetworkManager / ansible-network-role it seems that the paramter
state
can have more values. In your case you could first check how it is implemented there in the project role and test after withstate: up
andstate: down
accordingly.Regarding
it seems that if connection becomes created it is brought up, as well if connection becomes removed, it is brought down before.
Further Documentation
nmcli
community.general/plugins/modules/nmcli.py