This requires to make "library/network_connections.py" more
independent from ansible modules
In the end, the Python code runs on the target machines,
with the python installed there. So, it makes sense to also
run the unit tests as part of the CI tests.
The unit tests should run without requiring the
ansible module.
At least, all currently existing tests can now run.
In the future, we might have tests that optionally
only run when the ansible libraries are available.
As the module runs, it constructs debugging information
in run_result array. That is, because we can only pass
on the debugging messages at the end during json_exit()
or json_fail().
During early stage of run_prepare() we must also ensure
no to loose messages.
We should not set "dhcp4_send_hostname" unless it is explicitly
present in the configuration. That is because initscripts don't
support this parameter and issue a warning.
It's more idiomatic for ansible then "on_error".
'ignore_errors' can be specified as a module argument.
But it can also be specified on a per-profile level,
with the intuitive behavior that the per-profile setting
overwrites the per-module setting.
We use libnm for the async operations. We would expect that
an async operation always returns, but there might be a bug
in libnm so that it doesn't
Add our own timeout around the libnm calls to avoid hanging.
Instead, of having the tasks call the "network_connections.py"
library for each connection profile individually (using with_items),
pass all profiles at once.
The advantage is:
- the module can validate the input arguments better as it has
access to all profiles. For example, when a slave connection
refers to another master profile from the same play. Previously,
each invocation of the module only sees the current profile and
cannot verify whether the reference is valid.
- while configuring the network, the play might need to shortly
disconnect the control connection. In the previous way, after
tearing down the network the target host becomes unreachable for
ansible and the following steps cannot be executed anymore.
Now, all steps are done as a whole on the target host, via
one connection. If the host becomes unreachable for a short
time, that is not a problem as long as the connectivty is
restored at the end.
Ansible also supports to switch the host IP (or SSH port). With
this new way, the ansible play can apply a bunch of profiles
autonomously and the ansible play can potentially handle a changing
IP configuration.