Commit Graph

35 Commits

Author SHA1 Message Date
Gene Oden 71ecf3b13e Add support for the ArchLinux distribution
Change-Id: I352e049be2c98fddef01184282842946d937b27b
2024-01-03 00:22:52 +00:00
Dmitriy Rabotyagov 70442c5efb Fix defenition of multiple static routes for network
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
2023-12-09 05:24:57 +00:00
Dmitriy Rabotyagov 18b36137dc Ensure filename is always defined for network/netdev
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
2023-12-08 17:51:16 +00:00
Dmitriy Rabotyagov 1e6fc97dbe Fix linters and metadata
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
2023-07-12 12:33:19 +02:00
Dmitriy Rabotyagov 0ae090b0d5 Add repos only when there're packages for install
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
2022-10-14 18:21:37 +02:00
Erik Berg 356db62780 Remove redundant vars line
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
2022-09-15 12:26:56 +02:00
Jonathan Rosser c802d037b9 Refactor use of include_vars
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
2022-01-12 07:59:06 +00:00
Dmitriy Rabotyagov 4ca473b944 Use config_template as a collection
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
2021-11-30 15:17:07 +02:00
Jonathan Rosser ce9cba08a8 Remove references to unsupported operating systems
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
2021-03-16 08:58:38 +00:00
Zuul b812fff93a Merge "Use ansible_facts[] instead of fact variables" 2021-02-25 13:30:32 +00:00
Jonathan Rosser 63ad4cffac Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I36a098e4b028bdf09b38e2f2c99f68f311ce9d32
2021-02-24 14:26:31 +00:00
Jonathan Rosser 3213d427e6 Add reference to gpg key location to EPEL repo config
This is necessary on centos-8 stream

Change-Id: I74f02669b013b8580d3469a8ffe214d88cd0f525
2021-02-17 16:17:36 +00:00
James Denton 48a217bf2d Add GPG Key for EPEL8 Repo
The patch adds the GPG key for the EPEL 8 repo to allow gpgcheck
to be successful.

Change-Id: I6402d45ca541b8bb7a35ed73b63256f13c58e4f3
2020-11-02 10:22:15 +00:00
Dmitriy Rabotyagov 438e946a06 Add CentOS 8 support
Change-Id: I8eb7b1ce7cadc910386cfb8bf1d9b41194b2ecdd
2020-06-23 12:44:21 +03:00
Dmitriy Rabotyagov c449573e72 Fix systemd-resolved config conditional
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
2020-05-15 14:27:59 +03:00
Jonathan Rosser aeb49ce67e Do not use deprecated ansible 'bare' variables
Support for this syntax will be removed in ansible 2.12

Change-Id: I3fb3c87b027bbe69c96069a758e7d30fbaf091db
2020-05-12 09:28:50 +01:00
Michael Vollman 242b3c3fb4 Add ipforward option to configure IPForward
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
2019-02-11 09:55:26 -05:00
Kevin Carter 2921156fd1 Move link options to a link file
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>
2018-12-27 21:31:16 -06:00
Zuul 8715f97e8c Merge "Add async to the networkd start task" 2018-08-18 22:59:56 +00:00
Kevin Carter 9f6857f602
Add async to the networkd start task
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>
2018-08-18 17:36:50 -05:00
Jean-Philippe Evrard a116425bef Fix usage of "|" for tests
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
2018-07-12 17:03:31 +02:00
Zuul 305db5348e Merge "Update cleanup process and set a file prefix" 2018-05-21 05:03:36 +00:00
Kevin Carter b0395c727e Update cleanup process and set a file prefix
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>
2018-05-19 05:40:48 +00:00
Kevin Carter dc4353273b Remove flush handler
Change-Id: If6a55afc1c731c7006155ece2138758f0faf246e
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-05-18 23:49:41 -05:00
Kevin Carter b6a4cfe946
Update role so we're not reloading the daemon in excess
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>
2018-05-18 22:16:02 -05:00
Kevin Carter 955e445969 Updated systemd networkd role to fix hangs
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>
2018-05-13 20:52:32 +00:00
Kevin Carter 12ae3acd6e
Add resolved to the networkd setup
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>
2018-05-10 14:13:27 -05:00
Kevin Carter d8bcdc0341
Update initramfs when links change
In order to make the default link take effect initramfs needs to be
updated. This change also updates the default link to use the
recommended defaults from the systemd-networkd documentation.

Default link config:
- https://www.freedesktop.org/software/systemd/man/systemd.link.html#Examples

See this thread for bug info:
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=793374

Change-Id: I5430da4acad1e36b7593ad6791afbebf9e730bba
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-04-16 07:51:01 -05:00
Zuul fa116c179e Merge "Add base role tests" 2018-03-21 14:12:07 +00:00
Logan V cebf3b3482
Add base role tests
Depends-On: https://review.openstack.org/#/c/554402/
Change-Id: I3b270cc65aedaf9ef7375289b0ff7373b2c8d705
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-03-21 00:18:24 -05:00
Zuul a2b8fceddc Merge "Implement networkd restart as handler" 2018-03-21 03:09:16 +00:00
Logan V d9849f1d37 Implement networkd restart as handler
Change-Id: I1b49cc62d01fe2e3aa5766eea898c771ec6ac3d1
2018-03-19 14:57:05 -05:00
Logan V b9b135ab9a Allow networkd filename override
- Allow configuring the default filename format
- Allow configuring a filename override on a per netdev/network
  basis.

Change-Id: I801fe5604d543ae36daf5bd1764ef1035644ea44
2018-03-19 14:54:35 -05:00
Logan V 77dbdfed34 Create cleanup script before attempting to execute it 2018-03-16 21:34:57 -05:00
Kevin Carter dd82b31ee2
first commit
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-03-13 23:09:48 -05:00