Current logic was relying on iteration inside the template. However,
since config_template module was used to deliver network configuration
it was merging sections having same name together.
While this behaviour is correct one for config_template as all sections
must be unique from ConfigParser perspective and in order to apply
overrides properly, it was not suiting the way how routes should be
defined in networkd configuration.
To workaround the issue we place routes separately under <network>.d
directory, which should be supported by systemd [1]
[1] https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html
Closes-Bug: #2045819
Change-Id: I01aa44dcdc85e32d18dd52bcd4878a9017fb6ead
Right now we define resulting filename in the loop itself, which limits
ability to predict expected filename for another loop where list might
get filtered.
So to get more expected behaviour between tasks we always add filename
to the elements in vars.
Change-Id: I579980ea3a5e9349d25885530c979649cb6dcb81
With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.
With that we also update metdata to reflect current state.
Change-Id: I3aa1a19eb1aa735bafb29e5babe433b77a8d1f47
At the moment we allow not to install packages by providing
systemd_networkd_distro_packages as an empty list. When that happens
it makes sense also to skip all tasks related to adding repositories
when no packages are going to be installed.
Not installing packages might be useful for containers creation or
in situations when there is no networking yet, but we know that
systemd-networkd is already present.
Change-Id: I5e12cb0eb07b5eb8dcca462dbe8239a926ef80e6
This line snuck in with I4d4a51ca805857d56f108c3717beaa5648f86ccb
probably to bring it in line with other OSA roles, but should already
be covered by the distribution_major_version line above.
Change-Id: Ifcf3506cc8b4da41c5cca29b53955c5153a18cc3
Use a first_found lookup instead of a with_first_found loop so that
the 'paths' parameter can be used.
This ensures that only vars from the role are included, and not vars
from a parent calling role. This can happen when a parent role has
a higher priority vars file available for inclusion than the role
it calls.
Change-Id: I4d4a51ca805857d56f108c3717beaa5648f86ccb
Since we still use ceph-ansible that has their own implementation of
config_template module it's worth to use mentioned module as a collection
explicitly.
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/819814
Change-Id: I7024d962ed858b0442583e24612a5da4d3fa37e7
All references to Gentoo, SUSE, Debian stretch and Centos-7 are removed.
Conditional tasks, ternary operators and variables are simplified where possible
OS specific variables files are generalised where possible
Change-Id: I214f35cfff5fa9dd703733f795d6a7e414d729ca
Variable systemd_resolved is supposed to be a dict. When bool filter is
applied to dict it returns false despite dict have any values or not.
So we need to change that logic to verify if we have empty dict or not.
Change-Id: I17d5bebe4bd1c133798161f27e08bd2989848178
Add ipforward bool optional setting to systemd_networks to enable
or disable forwarding for a given interface. IPForward is disabled
by default.
Change-Id: Iaea33b1bdde1964f38612ab8c278fed4985d390b
The link options being set within the network files, which functional,
does not expose all of the link capabilities we have within a specific
link file. This change implements link files per network interface
giving the user the ability to customize links as they need.
Change-Id: Ie999c541a6a566141e81c6d9f95b8a30bbbefa8c
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
The async function was added to the restart handler but not the start
task. This change adds the missing async which will ensure we're not
hung on transient networkd starts.
Change-Id: I81a9e578875a43f7581abec0a3bf0c4067ab4d41
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
With the more recent versions of ansible, we should now use
"is" instead of the "|" sign for the tests.
This should fix it.
Change-Id: I121deed7c095899a07ab030b77ccd7ecc55c0b18
The interface cleanup was generating a script that could be used to run
a cleanup whenever required. While this worked it would rapidly become
out of date, especially when multiple roles are calling this role. This
change adds a prefix which deployer can use to ensure the network
interface files are marked which will ensure we're limiting the
possibility of collisions.
The cleanup process will now use this prefix to search for and remove
any network interface file that matches the given prefix.
Change-Id: Ife5c179d27925cd2e71d3d086a731e6c13b12965
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
The systemd-networkd role was reloading the systemd daemon on every run
this change removes that as this role will not need to modify anything
that requires a daemon reload.
Network facts will be gathered after this role executes which will
ensure any state changes are picked up as soon as they're available.
Change-Id: Ib3efa6a1662da48d0f58e00ed77f725e1a950edb
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
Sometime systems will hang when executing many systemd options at the
same time. This change breaks up the systemd enabled/start/daemon_reload
tasks so that we're only enabling and starting when "systemd_run_networkd"
is set to true.
Change-Id: I3572337edc87b5753f9d4a9b480fdba76e98e8ef
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
If the new variable systemd_resolved is defined, resolved will be setup
within the environment. This will configure the global configuration
file and restart the service.
A test has been added to ensure this code path is exercised on every
commit. It should be noted that suse does not have a resolved package so
this functionality is disabled when a suse system is encountered. This
should be revised as soon as suse has resolved available.
Change-Id: I85278719bc5b7158244fd44c65d4366935555780
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
Depends-On: https://review.openstack.org/#/c/554402/
Change-Id: I3b270cc65aedaf9ef7375289b0ff7373b2c8d705
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
- Allow configuring the default filename format
- Allow configuring a filename override on a per netdev/network
basis.
Change-Id: I801fe5604d543ae36daf5bd1764ef1035644ea44