For a connection in example named eth1
the equivalents for show
, up
and down
are
nmcli con show eth1
nmcli con up eth1
nmcli con down eth1
Whereby in nmcli
module are certain Parameters for
Manage the network devices. Create, modify and manage various connection and device type e.g., ethernet, teams, bonds, vlans etc.
a parameter for bringing a network interface up or down is not explicit named.
This might leave one to think to workaround it with
- name: Brings the interface up or down
command:
cmd: "nmcli con {{ CMD }} eth1"
register: nmcli_con_cmd_result
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 with state: up
and state: down
accordingly.
Regarding
I can create an interface with ...
it seems that if connection becomes created it is brought up, as well if connection becomes removed, it is brought down before.
Further Documentation