Commit Graph

37 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov 3cdcb1115f Fix linters issue 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: I6a9986cd948dbeaf2847ea4dd04deed974f80d20
2023-07-11 21:43:23 +02:00
Dmitriy Rabotyagov d2a3a22a58 Properly render sysctl-container
Inside jinja block variables should not be inside start/end block.
This used to work due to the workaround placed in config_template
that was removed within [1]. So we fix our usage of jinja to make
variable resolved properly.

[1] https://review.opendev.org/c/openstack/ansible-config_template/+/881887

Change-Id: I1c3178e5694b08ace9364f6da397837049ca2d49
2023-05-19 11:38:28 +02:00
Dmitriy Rabotyagov 5af3d0c200 Replace systemd_service templates with role
For consistency reasons we try to leverage our systemd_service role as
much as we can. Instead of maintaining separate systemd unit templates
the role can be leveraged for same purposes and reduce complexity in
this role.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/865952
Change-Id: I59e6504240eafdb5f0d010ff8a051078e25b1281
2022-11-29 08:28:17 +00:00
Dmitriy Rabotyagov 517b75ac61 Replace usage of networkd template with role
For consistency reasons instead of placing a template for
systemd-networkd we better use systemd_networkd role that is present
for a while.

Change-Id: I1e9deaa2892a8fa7eb171acaf75441d7efeac297
2022-10-14 16:17:19 +00:00
Jonathan Rosser 91b7997b34 Unify variables for all operating systems.
Refactoring of the lxc_hosts role means that there is no need for
differences in variables between operating systems.

This patch makes the ubuntu focal CI jobs non voting as it must
merge at the same time as a corresponding patch to lxc_hosts.

Change-Id: I29e91320baebb9a3a649533a0e1d3a433dd04ad9
2022-04-27 15:58:29 +00:00
Jonathan Rosser 105d467a3b Allow redhat.yml to support any distribution and major release
Change-Id: If230992ba779bc8fffb953c4dd56bca9b4edc247
2022-02-14 16:54:25 +00:00
Jonathan Rosser 06ac9563a4 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: I2defac928ff0081b262ba31bdb9981274f13b32b
2021-03-17 08:36:24 +00:00
Jonathan Rosser 5d22a389c2 Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: If6b30e40bf71f60ee72fdc1459ce5e5a9f4f7d93
2021-02-24 14:18:48 +00:00
Jonathan Rosser 3ffa57d561 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/742166
Depends-On: https://review.opendev.org/742103
Change-Id: I6f72eb69f54ae780712831dbcb2f9151478e8b83
2020-10-05 18:08:11 +01:00
Dmitriy Rabotyagov 4153583bc4 Remove obosletd lxc_container_interface variable
These variables are not used anywhere, so no need to carry them

Change-Id: Ib4b972a76bb63dba90d024f452724fec19411b87
2020-07-01 23:27:31 +03:00
root 044dabe435 Add Centos-8 support
Change-Id: I67b334c6ec173460ce3a2bcec0e5c083c4deee6b
2020-07-01 23:26:05 +03:00
Jonathan Rosser 1bcea4abcf Use a single vars file for all ubuntu releases
This adds support for focal without requiring a second vars file.

Change-Id: Id21b3bc6721511d8d4a6b3e16ac465d14ec1a7f6
2020-05-28 16:14:47 +01:00
Jonathan Rosser a66fe0bca2 Remove Xenial support and CI jobs
OSA does not support Xenial beyond Rocky.

Change-Id: I5b0f1e251052d01c05f8be6c90b6483e57c364e4
2019-05-16 09:42:37 +00:00
Nicolas Bock 98d2203386 Update LXC container config options
OpenSUSE Leap 15.0 now ships with lxc 3.1 which changed two config
options:

1. lxc.kmsg was removed
2. lxc.pts was renamed to lxc.pty.max

This change updates these two options in the container config.

Change-Id: I7b4c657e9216b5e3926672b76cb370256b98ce3c
Depends-On: I8a94f340b8866f3369cebb5950dea873f5d2fece
Signed-off-by: Nicolas Bock <nicolas.bock@suse.com>
2019-05-10 16:11:50 +00:00
Mohammed Naser d6adeb8039 debian: add support
This patch adds support for this role to be able to deploy on
Debian Stretch.

Change-Id: I4ee130917373c643ae80bab7a778cc6f35868dc8
Needed-By: I135ea73604890eae5e9e2a7cdcab81b2b39ad426
2019-04-07 01:04:20 -04:00
Matthew Thode c84d4924ef
Add gentoo support
Required to support Gentoo is the ability to bind mount a new shared
directory.  In order to support this, _lxc_container_bind_mounts has
been created for use in per-distro variables.  For Gentoo the new bind
mounts allows the sharing of package data, shrinking both the container
size and the time needed to install packages.

Also needed was the creation of the `sysctl_path` variable as Gentoo
installs sysctl to an alternate location.

Change-Id: I8c20631aff9ee30289ef2f7f862ba0d4e1bb4569
2019-02-26 09:00:13 -06:00
Mohammed Naser 952353bc72 cleanup: remove rocky-only upgrade code
This code was put in to handle upgrade and transitions from Queens
to Rocky and it is no longer necessary in Stein.

Change-Id: Iffc453ccb8af5d66e556da8427eb4fec1c2133ca
2018-11-27 10:33:27 -05:00
Mohammed Naser b15b97fa0a redhat: stop updating system unnecessarily
In RHEL-based operating systems, the update will actually attempt
to update every single package in the system which can result in
bad things (i.e. updating services when they're not supposed to).

The intention was to do the same as the apt-get update which simply
updates the repos. however this is not necessary in CentOS.

Change-Id: I5a1f86899406e125b3a790e2e85ce36d73fbc55e
2018-11-26 15:49:31 -05:00
Markos Chandras 107c21c220 SUSE: Add support for openSUSE Leap 15
Depends-On: https://review.openstack.org/#/c/578281
Change-Id: I21cf4143fb2489f4d5a0e7c78e32ba703d78faa2
2018-06-27 07:40:53 +01:00
Zuul 9c234be15c Merge "Allow special purpose container interfaces" 2018-05-31 19:20:47 +00:00
Jonathan Rosser 2f14860628 Allow special purpose container interfaces
Some use cases such as public facing dns servers for Designate
are difficult to deploy with the dynamic inventory as they have
a hard requirement for fixed IP on certain interfaces. An additional
variable allows the deployer to create these special interfaces.

Change-Id: I4f0ac58f2d5c19fea1606fe1fbb011bb1a36f7b4
2018-05-31 18:36:57 +01:00
Jean-Philippe Evrard 62eff6ca2a Add Bionic testing
Now that bionic testing is added into the tests repos, we can
start testing it in the repo.

Since bionic uses lxc >= 3, we need to make some adjustments to the role
to allow the role to work with both lxc > 3 and lxc < 3, there were
several config options changes which will impact on upgradeability.

LXC >= 3 requires networks to have an index, we can achieve this by
taking the network dict and converting it to a list, and using those to
generate the id "with_indexed_items".

Depends-On: https://review.openstack.org/#/c/566959/
Depends-On: https://review.openstack.org/#/c/567038/
Change-Id: Ib80c2ed2a01a4a6a8c48aed9bdf9a50e45ea9564
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-05-24 00:02:19 +00:00
Kevin Carter 846b4f9ed2 Allow deployers to define the container type
The variable `lxc_user_defined_container` has been added which allows a
deployer to define the container variable file in use for a given
container type.

Depends-On: https://review.openstack.org/554383
Change-Id: Ia1373bfa916b4add49a8444d2e4553f898650328
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-03-24 01:18:07 +00:00
Kevin Carter 514a894cce
Remove generic default interfaces
With the implementation of networkd the ENI scripts and config files for
the default interfaces shipped with the lxc container images we use is
no longer useful. These old files can cause conflicts in networking
should the old scripts and networkd get confused especially when it
comes to an interface that is setup for DHCP. This change simply defines
the default interfaces for both suse and ubuntu and ensures they're
deleted.

The interface flush handler has been set to failed when false because on
initial container create the eth0 device may not exist until
systemd-networkd is restarted for the first time.

Change-Id: I70abb5ec4226a81a065e495e19f5e7e0c569e1b0
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-03-17 12:55:49 -05:00
Kevin Carter 815ece7454 Unify container network interfaces with networkd
Unify container network interfaces using Systemd Networkd for ubuntu,
centos, and openSUSE. This change allows the role to use a single way to
configure container networks.

Care has been taken to ensure we're able to cleanly upgrade to the new
capabilities within existing environments without breaking any feature
compatibility or causing any container restarts.

It's also worth noting that all of the pre/post networking up/down
script options have been converted to systemd "oneshot" services. This
retains the ability to run adhoc scripts post network availability
while also opening up this capability, which used to be ubuntu only,
to all of our supported operating systems.

> Our usage of `lxc-attach` was removed in favor of `nsenter` to fix a
  issue where multiple `lxc-attach` commands issued to a single physical
  host could result in a hang.

> Scripts that were being generated inline have been placed into
  template files. This solves a long standing memory consumption issue
  when creating lots of containers. The old shell tasks will now be 
  executed from a generated script. While this should also help with 
  debugging, the main driver is to ensure better system stability.

> A lot of cleanup has been done throughout the task files and
  templates. In the process of updating the role to use unified
  networking a lot of duplicate tasks, scripts, and processes have
  consolidated.

> Handlers have been added for network connection wait conditions and
  to various service restarts.

> The OSA plugins have been added to this role as a dependency. We
  rely on the connection plugins throughout the stack however we were
  doing a lot of workarounds to cater to the possibility of a deployer
  running this role without them. This change simply adds the plugins
  as a known dependency which allows for a more streamlined setup.

Change-Id: I5d3ddcfa11d575648a69a04f2fb30236c2c89da3
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-03-01 10:55:14 +00:00
Markos Chandras 807256d990 SUSE: Use physical hosts facts
The role may be used with 'gather_facts: false' leading to the
following problem:

'ansible_distribution_version' is undefined

As such, we need to rely on the discovered physical host's facts to
determine the distribution version.

Change-Id: I11ab98ac0a6f5e8cbcdc55d51ba7886e54aa5472
2017-08-15 10:56:13 +01:00
Markos Chandras d82db7e64b SUSE: Use host's version for base container
This supplements commit Ic43aa5d7e6bc7a534e21ba052561932ec01b3ae0

The base container now matches the host's distribution version so we
should use the 'ansible_distribution_version' fact instead of hardcoding
the version number.

Change-Id: Ie8d8ef236fcaa8b008e08c935d6efed3d64e728e
2017-08-15 04:59:50 +00:00
Markos Chandras ce700c1fad Add SUSE support
Add support for SUSE based distributions. We also update the bindep.txt,
run_tests.sh, tests-repo-clone.sh and Vagrantfile files from the
openstack-ansible-tests repository.

Change-Id: I9ac018ac1a94dac74a2ef213dccedf95b4272134
2017-05-15 14:04:42 +01:00
Markos Chandras 389d631500 Fix logic for installing a routing file
In Ansible, a "string"|bool jinja2 filter does not result to a true
value as presented below:

~$ ansible localhost -e foo="string" -m debug -a "msg={{foo|bool}}"
localhost | SUCCESS => {
    "msg": false
}

Only a "true" string results in a boolean True value

~$ ansible localhost -e foo="true" -m debug -a "msg={{foo|bool}}"
localhost | SUCCESS => {
    "msg": true
}

as such, the routing files where never installed for the RedHat
distributions. We fix this logic by simply leaving this variable
undefined for the distributions who don't need it.

Change-Id: I0af0ad47487365ad593c5550d2c7e05f650e7174
2017-05-08 08:59:59 +01:00
Logan V eeabfbc042 Enhance configurability of LXC net interfaces
Add the ability to append pre-up, post-up, pre-down, and post-down script
entries to the container_networks dict that are dropped along with the OSA
default configurations when templating the container's interface config files.

The keys preup, postup, predown, and postdown will be appended to the OSA
lxc_container_default_{pre,post}{up/down} lists when dropping the interface
config.

Change-Id: Idf15ec17bac03b55638fb8d862e5445093677f23
2017-03-22 11:48:04 -05:00
Andy McCrae ae22ddc970 Remove Trusty support from lxc_container_create role
Change-Id: Ib1c83be6ed07c3c804704c2419e32c4d50fce04e
Implements: blueprint trusty-removal
2016-12-15 12:38:59 +00:00
Kevin Carter b35928cf83 Change the container prep using more intelligent commands
When creating many containers on a single contended host, the execution
of many delegated tasks in parallel results in failure. This patch
consolidates the container prep and networking tasks leveraging the
lxc-rootfs pid path on the physical host instead of relying on delegation.

Change-Id: I0823e34286a0857b539a94604dbe9cdeb8a605f0
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-09-15 02:34:10 +00:00
Jesse Pretorius 93c5b5f9f9 Ensure that lxc_container starts/stops are logged
This patch ensures that all lxc_container starts/stops are
logged in the container debug log.

Change-Id: I494ab938f18adc42a0e11781434228642acb5930
2016-08-18 01:36:58 +00:00
Jesse Pretorius 56792db4db Remove standard container prep as it has moved
With https://review.openstack.org/354097 the container prep and
network config for eth0 into the cache preparation.

This patch therefore removes the duplicated prep.

Change-Id: If9abcff780fbf97b83b6f46704088adead30e910
Depends-On: Ia8c0bb759b5df29f1b3a5e11230040ffc6e97362
2016-08-11 11:35:29 -05:00
adreznec 41800e3eae Add Ubuntu ppc64le support
This commit adds support for container creation on Ubuntu ppc64le.
It maps the ansible architecture to the correct lxc architecture
and sets the container arch accordingly.

Change-Id: I1f142686d7190e5bfe7147366d406381b5011725
2016-06-29 22:58:51 -05:00
Jesse Pretorius 46de08da3b Make the LXC container create use the host resolver config
The current container creation process overrides the DNS resolution
configuration instead of consuming the configuration implemented
in the container cache preparation.

With the implementation of change I66b448dee361e231d172eb278b290ec4dccfdf97
The container cache makes use of the host resolver configuration.

This patch ensures that the container create process falls into line
with that instead of overriding the cache configuration.

Change-Id: I0f12a50471e670a03e17bfaa2c150a8da3f63af4
2016-06-07 13:29:45 +01:00
Kevin Carter 0c16334a2c
updated for lxc-container-create for multi-distro support
This change updates the lxc-container-create role to build lxc containers
using the download template. The build supports ubuntu 14.04/16.04 and
RedHat/CentOS 7 using the multi-distro framework.

This change is incorporating updates built into the lxc_hosts role. Once
merged this should unblock all work geared toward multi-distro support and
testing. The testing structure has been updated to match what is being done
in other roles.

A new file was created "manual-tests.rc" which assists in manual testing
by exporting the needed environment variables to run the role tests without
requiring everything to run through tox which has undesirable side-effects
when running tests that span multiple roles.

Change-Id: Iee304dd026e0865e0444259d2132122233d90f5f
Depends-On: Ie13be2322d28178760481c59805101d6aeef4f36
Co-Authored-By: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-05-03 15:15:34 -05:00