Closed avbg closed 1 month ago
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @alcamie101 click here for bot help
NetworkManager doesn't apply changes to an active connection until the configuration is reloaded. In Ansible you would typically notify a handler to either restart NetworkManager or run nmcli con reload
. If we added an option to do this it probably wouldn't be a new state, but something like reload
which when set to True
would toggle active connections with con down
and then con up
.
It's not so important through an option or through a state. it is much more convenient when inside the module, and not through the handler.
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
Different operations can require different commands to apply them. Usually restarting NetworkManager is not the recommended/desired thing to do except for some special cases (0 1 2)
It is not necessary or recommended to restart NetworkManager to reload interface configuration files.
Note that a restart of the NetworkManager service is usually not required, for example when doing changes to the networking configuration. This is one of the exceptions.
Even nmcli con reload
may not work in some cases:
Note: This action only makes NetworkManager aware of any changes to configuration, it does not apply changes to an already-up connection.
Personally I have found it pretty confusing to determine which operation is needed to apply what kind of change when using NetworkManager, which in turn makes it difficult as a user to try to make the nmcli module apply changes, even if I had to write a handler for every invocation of the module which would be very cumbersome.
Often nmcli dev reapply devicename
is the right thing to do, but not always, e.g.
# nmcli dev reapply bond0
Error: Reapplying connection to device 'bond0' (/org/freedesktop/NetworkManager/Devices/14) failed: Can't reapply 'lacp_rate' bond option
so in that case nmcli down/up bond0
is required. That makes a total of 4 (at least) different possible commands that may be required to apply a nmcli change!
Anyway even just considering the one case of nmcli dev reapply devicename
, making a handler to reapply the device that has been changed would require a variable (apparently using variables in a handler requires include_vars ???) and more complexity in crafting tasks properly compared to the module just doing a reapply while it is modifying a device.
Preferably the ansible module would "do the right thing" to apply whatever type of change is made with some option apply
or reload
(default True).
Summary
Problem: how to apply the configuration on the host after launching the "nmcli" module? Now I do it through the nmcli up handler. maybe there is another option that I don't know about?
I expected that with the "present" state, they would be applied, since this is the internal mechanism of the NetworkManager. Perhaps a new state should be added for this?
Issue Type
Feature Idea
Component Name
nmcli
Additional Information
Code of Conduct