Commit Graph

98 Commits

Author SHA1 Message Date
Damian Dabrowski 56d69ce9e8 Fix resolved config on Debian
Currently, file /etc/systemd/resolved.conf.d/openstack-ansible.conf has
incorrect format and is being ignored:

```
systemd-resolved[740]:
/etc/systemd/resolved.conf.d/openstack-ansible.conf:2:
Missing '=', ignoring line.
```

Change-Id: I23529b0dd032cbb6ba59acc3d3b668c06847da08
2024-01-05 12:26:31 +01:00
Jonathan Rosser d57f9a8f47 Remove lxc_cache_map variable
This has not had any practical use for several releases and mostly
carries copies of ansible facts. Remove the variable and use the
facts directly.

Change-Id: I1d2be9d07b38eaf2b737819c451a0d2339f723d0
2023-10-11 15:56:08 +00:00
Jonathan Rosser 39542e2c65 Switch to native systemd-resolved from resolv.conf
Rather than edit resolv.conf, use the recommended method of
operation for systemd-resolved and configure the dns server
through a resolved drop-in.

Change-Id: I1b08a45ccced87ecd200f3e7294165e922df39ff
2023-09-29 12:44:13 +00:00
Dmitriy Rabotyagov 3d8e3690ba Replace ifupdown with native ip-link
We also leverage systemd-networkd for managing lxc-net and replace
using of custom service template for lxc-dnsmasq service with our
systemd-service role. These changes are quite tighten together, so
it's quite hard to split them in different patchsets.

Depends-On: https://review.opendev.org/c/openstack/ansible-role-systemd_service/+/861350
Change-Id: I5ac99e2b6c6e6ccd9da18ae68e1f8801f95f4f4e
2022-11-11 09:57:56 +01:00
Dmitriy Rabotyagov 3d25c4f72b Cleanup unused templates
aria2c and systemd-proxy templates exists but they are not referenced
and used by playbooks nowadays. Thus, we can safely remove them

Change-Id: I5223138aa7e50c92531076fe7764f204bfec3e24
2022-10-14 13:24:35 +02:00
Jonathan Rosser 3b8d1459b9 Disable apt phased updates inside containers.
Inside a chroot, phased updates are disabled [1]. This means that
the container base image always gets the latest packages regardless
of what is happening with the phasing.

At runtime, the default in Ubuntu releases 21.04 and onward is to
obey the package phasing information. This means that packages
inside the OSA built container image can be newer than the installation
candidates once the container is running, leading to installation
errors. This is particularly sensitive with source packages such as
systemd where there is a very tight version coupling between
all components leading to only one valid installation candidate.

This patch creates apt config inside the container base image to
always install the latest package version regardless of phasing.

There does not seem to be any alternative, as phasing is always
disabled during the debootstrap.

[1] https://discourse.ubuntu.com/t/phased-updates-in-apt-in-21-04/20345

Change-Id: Ia558e3aa1447220016c53349cf9dac0b822d06f4
2022-05-30 12:39:45 +00:00
Jonathan Rosser fd23eeedfc
Add centos-9 support
Remove installation of aria2 everywhere as we no longer download
lxc images but build them locally.

Change-Id: I5eba0b1f08cfe23998cf1116bb017e8a8ef0bb72
2022-05-19 17:23:09 -04:00
Dmitriy Rabotyagov 3928a0b914 Clean up NFV OpenvSwitch repo for container build
NFV repo is supposed to be installed using system packages, as it should
also contain nfvsigdist variable for yum.
So avoid issue with yum update at this step we drop the repo that was
copied from host.

As alternative approach, we can drop copying yum.repos.d at all, but this
can lead to an unexpected results.

Change-Id: Ia5041c7d855a9e988afc4c2a0d16fdeb6a9c357f
2022-05-17 12:53:20 +02:00
Zuul c679877aba Merge "Unify debian and ubuntu cache prep scripts" 2022-04-29 17:05:26 +00:00
Jonathan Rosser d72ed7e469 Unify debian and ubuntu cache prep scripts
These should be able to be common, with a dictionary added to select
the right libpython version to install based on the OS release.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-lxc_container_create/+/839167
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/838762
Change-Id: I2cb97a25237a0495ea8d9001d80d06b134b8e500
2022-04-27 08:35:00 +00:00
Jonathan Rosser 8626a26d9a Ensure systemd-udev is present in centos containers
This is needed to ensure that systemd-tmpfiles-setup service
is present, which is used to create /dev/fuse in centos containers
in other parts of the osa-gluster patch series.

Change-Id: I6a6401debad4937eb9f6a5be31c8cee42d7035cd
2022-04-19 11:07:20 +00:00
Dmitriy Rabotyagov ed38f3393d Change location of ipaddr filter
ipaddr filter has been moved from netcommon to utils collection [1]

Based on that we must add that collection to requirements.

[1] db4920ebf6

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/831525
Depends-On: https://review.opendev.org/c/openstack/ansible-role-systemd_networkd/+/831603
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-lxc_container_create/+/833118
Change-Id: I5412e9b4e85373c920b127a96dc9d505ca9fe337
2022-03-14 15:10:30 +00:00
Zuul f16e0c8112 Merge "Clean up bionic variables" 2022-02-21 16:12:37 +00:00
Dmitriy Rabotyagov 65311aec6d Clean up bionic variables
Since 18.04 is unsupported, we cleanup related variables and
preparation scripts.

Change-Id: I5d25d63a30f24ac5daf3268c03b3248415a42cc7
2022-02-18 15:33:11 +00:00
Jonathan Rosser b614fe16a4 Generalise redhat variables to handle any distro and major release
Change-Id: I14fc02983efd807af97efe5689152d6562deafb9
2022-02-14 16:38:21 +00:00
Matthew Thode f7ea823d80
allow release info change on apt update
debian buster changed from stable to oldstable, without this change
apt-get update fails to run on old systems.

Change-Id: I6527d2c0c361c03cbb6fc43aa3a03896894fb8e1
2021-10-05 11:58:08 -05:00
Jonathan Rosser 791b9e813e Optionally build container image as a local chroot
This change uses dnf to build the container image for Centos-8
using dnf locally rather than rely on an external image that is
downloaded and unpacked.

The existing image prestage commands are made conditional, and
an operating system specific command can be provided via role
variables to build a chroot in /var/lib/machines.

During the transition from Centos-8 to Centos-8-Stream, the
vars files are separated, with vars/redhat.yml covering Stream,
and vars/centos-8.3.yml covering legcay Centos-8.

In addition, the systemd-logind service is masked from the base
image. This is masked in the previously downloaded container base
image, so we ensure that the same is done for locally built chroots.

Depends-On: I31880ca995735b737d33532eaa4c29be02523117
Depends-On: I74f02669b013b8580d3469a8ffe214d88cd0f525
Change-Id: I1ddfe36259610b25e86b69d64d1d7f32a56c0e4d
2021-04-20 08:56:20 +00:00
Jonathan Rosser df9a63ea98 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: I79f68c467d48b9b50143fd3a11e176f91804e805
2021-03-18 17:01:48 +00:00
Jonathan Rosser 6de26d8519 Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: If64c72dc2ffbf87459b4729b9c03928efbf5177c
2021-03-04 14:24:37 +00:00
Jonathan Rosser 59abc5a288 Remove support for gentoo
Openstack-Ansible does not maintain support for deploying on gentoo
so we can simplify this ansible role

Change-Id: If2a63a2743714745e0f0b0eea2ee3d5b8d4c9a35
2021-02-17 19:14:55 +00:00
Jonathan Rosser 1e8055c5bf Remove support for openSUSE
OpenStack-Ansible no longer supports openSUSE so we can simplify this
ansible role.

Change-Id: I4c53307d0d4f7a72010b878953f34ba0c8784922
2021-02-17 17:31:23 +00:00
Jonathan Rosser 01eecae8d3 Fix linter errors
Change-Id: Ifed6a818868943c19bbdb3620582c2f2aca3b937
2020-10-02 10:40:16 +01:00
Jonathan Rosser cfcaff62e8 Remove support for Centos-7
Openstack-ansible does not support Centos-7 beyond Ussuri so drop
support for Victoria.

Depends-On: https://review.opendev.org/742103
Change-Id: I395e0f7b1d362240e67a86fa4545a8be64f3053c
2020-09-22 13:53:09 +01:00
Zuul c21fcdb583 Merge "move listchanges removal to where it's needed" 2020-08-04 18:17:03 +00:00
Jonathan Rosser eaae389a4b Add centos-8 support
Centos-7 uses tasks/lxc_isntall_yum.yml so we can put all of the
Centos-8 setup exclusively in tasks/lxc_install_dnf.yml which
means there are few conditional setup tasks needed.

Add cache prep and lxc host vars files for rhel-8 variants.

This patch takes the systemd-networkd package from EPEL and installs
it into the LXC image, so that the existing lxc_container_create
role can set up the container networking in the same manner as the
other supported operating systems.

Depends-On: https://review.opendev.org/738913
Change-Id: If57de332945291d139d54e9aed5d782a69a71d97
2020-07-05 11:17:07 +00:00
Matthew Thode 2aa1a6776a
move listchanges removal to where it's needed
listchanges config needs to be be removed before apt is run

Change-Id: I7c49f0cd7abb85e725296b17ecb88f34b50affed
2020-06-22 13:12:59 -05:00
Jonathan Rosser da4f62b006 Remove machinectl from LXC cache prep
machinectl is only used to store the image during
initial cache preparation and is unrelated to the
backing store used by LXC.

This patch removes the use of machinectl and btrfs
which makes the lxc_hosts role portable to centos-8
which does not have btrfs

Change-Id: Ib03ea09fa5b4d4b6b3d5ca38a0a6c5cf67eb1df4
2020-06-17 14:15:58 +00:00
Jonathan Rosser dfc9502e22 Stop installing python2.7 on debian/focal
We still require py2 and the lxc library on the host for bionic as
the bionic CI image still has python2 at /usr/bin/python and ansible
interpreter discovery picks that when targetting localhost.

Change-Id: Ie94afc5a3c794b1c2be266b6642bc9c74b533287
2020-05-31 09:07:38 +00:00
Jonathan Rosser 4d16a8883e Add vars files and container prep script for ubuntu focal
Change-Id: I2d0d42046d4535113deb75f8b22e7c33489b6f5f
2020-05-26 16:21:32 +00:00
Matthew Thode 40535a00d3 ensure 20listchanges is not in debian container
20listchanges has apt call apt-listchanges
apt-listchanges is not in the base container so we get a failure

Change-Id: I4b74670edd7b4ae9710dbb39deb82c0775a1ff66
Closes-Bug: #1839535
2020-05-01 16:58:36 +00:00
Jonathan Rosser 1e8314f609 Ensure mariadb packages are not in the lxc base image for debian
Debian ships a mariadb version which conflicts with the packages
installed by the galera_server role, so ensure these are absent from the
lxc base image.

Change-Id: Ic903de777d3d28962885fe4b73a3bf61a8d196f6
2019-10-09 14:20:29 +00:00
Dmitriy Rabotyagov 3d194c6de3 Use version test instead of version_compare
This test was changed to 'version' in ansible 2.5 [1].

[1] https://docs.ansible.com/ansible/2.8/user_guide/playbooks_tests.html#version-compariso

Change-Id: I04b8e4641f07c69f015fef01555f4b40f1817a32
2019-09-10 13:45:39 +03:00
Nicolas Bock ba8a339377
Use the 'real' name for the LXC image
The Open Build Service repository for the Leap 15.0 LXC image returns
a metalink which causes aria2c to download 2 files. The first is an
empty file (the metalink) and the second is the actual LXC image. The
name of the second file changes frequently.

This change uses the `--on-download-complete` callback of aria2c to
call a helper script which links the expected filename to the actual
filename.

Change-Id: I9a2bc7ded20f772af82956a81a9864c7ee17039c
Signed-off-by: Nicolas Bock <nicolas.bock@suse.com>
2019-04-25 07:12:30 -06:00
Antony Messerli d1c45fb0cb Use pkill for lxc-dnsmasq systemd unit file
Previously psmisc was not installed by default, causing
the killall in the lxc-dnsmasq systemd unit file to
silently fail if killall wasn't found.  This prevented
running instances of dnsmasq to be torn down when
restarting the service.

This would exhibit as a problem during upgrades as
the older dnsmasq service would be running and the
new service would be unable to take over the port.
This would cause lxc containers to lose connectivity.

This commit switches to using pkill and ensures procps
is always installed by default.

Change-Id: I4fa838706f1163fd68ff68258bfc66cbf13bad94
2019-04-11 11:04:51 -05:00
Mohammed Naser e90019f6bc debian: add support
This patch adds support for this role to be able to deploy on
Debian Stretch.

Change-Id: I865df7f5ff2b7022ec0922773b2a945ec7aff7f4
Needed-By: I135ea73604890eae5e9e2a7cdcab81b2b39ad426
2019-04-06 23:47:29 -04:00
Zuul 468cffb585 Merge "add gentoo support" 2019-02-23 04:35:29 +00:00
Matthew Thode 32d0a30c35
add gentoo support
Change-Id: Ieb1df06e6581601215851d78fb932a9d1e99e183
2019-02-22 19:43:59 -06:00
cloudnull 1fca76c8d3
Allow containers to remount volumes when needed
This change allows containers to mount and remount volumes as needed.
Before this change, when users had a mounted volume within a container,
like in the case of services using NFS or RBD, it was not possible to
remount a volume within the container runtime. While a user could
unmount and mount a volume or restart a container, these actions
results in service interuption where as a remount would simply
reload the mounted volume without service interuption.

Change-Id: Iff588cad451320167b92f2d79e4693a1037be966
Closes-Bug: #1814200
Signed-off-by: cloudnull <kevin@cloudnull.com>
2019-02-13 14:56:52 -06:00
Zuul b8914bd419 Merge "Increase LXC container default shutdown delay" 2019-01-20 21:46:28 +00:00
Justin Alford d0d9384aee Increase LXC container default shutdown delay
Increase container shutdown delay before force-killing to avoid db
corruption after controller reboots
Parameterize SHUTDOWNDELAY envvar as lxc_container_shutdown_delay
with default value 60 seconds
Rename lxc.default.j2 template to lxc-net.default.j2 to align with
destination config file name lxc-net
Add new lxc.default.j2 template to use the lxc_container_shutdown_delay
variable and allow user-defined value

Related-Bug: 1806696

Change-Id: I1d3b7990e462140fdb402883f8d25422eafca66b
2019-01-16 12:42:36 -07:00
Jonathan Rosser 4d9491b83a Use libeatmydata during LXC cache prep
The LXC cache prep is timing out regularly so use eatmydata to minimise
pressure on the filesystem during package installation.

dpkg calls fsync for each file installed from each package which can
result in very poor performance on some filesystems. This patch gives
around a 4x improvement in "slow" gate runs, and 2x on esxi hdd storage.

Change-Id: I1cc33a7647445cd2302e6ea6b9d78005262ebfa3
2019-01-08 07:05:08 +00:00
Vadim Kuznetsov 0fffb61ab7 ensure the mount unit is started after reboot
/var/lib/machines was not mounted after reboot
because of missing install section

Change-Id: I10f3b83e63ccdf08f9f782dee7f5be1fd7bbe139
2018-11-13 13:31:01 -05:00
Markos Chandras 3cdfd8c531 apparmor: Allow cgroup v2 mounts
Previously, only the v1 of the cgroup fs was being allowed by AppArmor
and this were causing problems like the following one

 audit: type=1400 audit(1540571957.300:196): apparmor="DENIED"
 operation="mount" info="failed type match" error=-13
 profile="lxc-container-default-cgns" name="/sys/fs/cgroup/unified/"
 pid=26738 comm="systemd" fstype="cgroup2" srcname="cgroup" flags="rw,
 nosuid, nodev, noexec"

Change-Id: I7f6ac8af0bc1c7d9844ee0c3505b65894d3b7aa1
2018-10-29 10:22:32 +00:00
Logan V f63abfa921 Use consistent apt options for upgrades
The 'apt-get upgrade' does not set confdef and confold currently, so an
upgrade which requires user input can break the cache build[1].

[1] http://paste.openstack.org/raw/733076/

Change-Id: Ic6689387a28539b7eb341d55a9db08f078e8e975
2018-10-25 14:58:12 -05:00
Kevin Carter 7125cde0f6 Change the default option name to reduce confusion
The default variable for different configuration keys between lxc 2 and
3 was being shared between lxc-hosts and lxc-container-create roles but
the functionality of the option is slightly different between the roles.
This change modifies the option to reduce confusion and ensures that if
the option is overriden it doesn't cause silient failures.

Change-Id: I3007843e99585ac96e499c2b1028bf3f92dd165b
Signed-off-by: Kevin Carter <kevin@cloudnull.com>
2018-10-11 14:20:08 +00:00
Kevin Carter 6ef6714ca4 make the lxc backend option conditional on lxc version
The lxc backend store configuration option is deprecated in lxc3. This
change ensures that the option is no longer rendered in the lxc template
when the version of lxc is greater than or equal to version 3.

Change-Id: I207ed1f89604979e74667ae4c603d36304a6ed53
Signed-off-by: Kevin Carter <kevin@cloudnull.com>
2018-10-10 17:07:25 +00:00
Kevin Carter 6405d287ec Add fstab and rootfs options to the lxc3 updates
The fstab and rootfs options have slightly changed in lxc3 this change
updates our templtes to ensure we're using the correct option for the
LXC version found on disk.

Change-Id: Ib1c563db70f3ddbeb3a65c55e0917777b27fd41f
Signed-off-by: Kevin Carter <kevin@cloudnull.com>
2018-10-10 01:00:17 +00:00
Kevin Carter 89dc180ca4 Update the option uts name in the machinectl template
The machinectl template was running with the legacy uts name option.
This change updates that option so that it uses the hash and major
version to update the config variable.

Change-Id: I85b5c92422116b139e447330214b2d6b5afbf948
Signed-off-by: Kevin Carter <kevin@cloudnull.com>
2018-10-10 00:59:34 +00:00
Jesse Pretorius 4f1db03d96 Make apt key import for Ubuntu a uniform process
In https://review.openstack.org/588962 the implementation
of the apt key store copy into the container was changed
for bionic, but left alone for xenial. This patch makes
the approach uniform across both distributions.

Change-Id: I79f49fd02be3bbee5f22cdde000b19578167e3ca
2018-08-25 21:18:42 +01:00
Zuul 137852188c Merge "Remove the checksum fills" 2018-08-16 04:53:37 +00:00