Commit Graph

22 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov bc258b4e19 Deprecate OpenStack-Ansible nspawn repositories
Since nspawn support has been removed with [1] we now
start repositories deprecation process.

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

Depends-On: https://review.opendev.org/c/openstack/project-config/+/797723
Change-Id: Ic80477b87a3ddc74ac1712f6bd4c3aba284fa1cb
2021-06-23 20:24:41 +03:00
Jonathan Rosser a041b4ec58 Ensure that facts are gathered for newly created containers
If this is not done before the systemd_service role is run then
the operating system specific variables file cannot be loaded
and the container creation will fail with:

TASK [systemd_networkd : Gather variables for each operating system] ***********
fatal: [container1]: FAILED! => {"msg": "No file was found when using first_found.

This is due to varaibles like ansible_distribution being unset
until facts gathering has been done, and the lack of facts gathering
is probably exposed by the recent upgrade to ansible 2.9.

Depends-On: https://review.opendev.org/728995
Depends-On: https://review.opendev.org/728997
Change-Id: Ifee09ed58e32584d799fca13f33f842765f9cfb9
2020-05-18 19:03:04 +00:00
ShangXiao de324b2319 Fix typos in the yml files
Change-Id: I489f7c180feb31b67fbb6d37b5ee5bc410e3a585
2019-11-04 16:40:54 +08:00
Kevin Carter 3279aed459 Remove the private option from include_role
The private option on include role was never implemented and
will no longer be developed. This change removes the option
so ansible no longer raises a deprecation warning.

Change-Id: I7678c1a5de07cda066dcf1e24684300fef56e0ba
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2019-02-22 00:49:34 +00:00
Kevin Carter fd7bb01097 Update the systemd-nspawn template for legacy systemd environments
The systemd-nspawn template has been updated to better support for
modern systems. This was primarily done for better centos and suse
support which have older versions of systemd.

Change-Id: I4c01102dae8445317a3a891861f2cd4bef20492b
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-12-20 11:40:08 +00:00
Kevin Carter 0b9d6a4178
Add a guard so we don't allow for duplicate config
The current network creation loop would allow a user to create duplicate
configs within a container and that can break parts of an environment.

Change-Id: I3585422fb134eec5ef2532515a6cda463b239f7c
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-10-12 15:59:25 -05:00
Kevin Carter 465ef2c09f Cleanup mounts in containers
Cleanup mount docs, remove redundant config, and set the default backup
mount. These change bring nspawn inline with our LXC capabilities. To
ensure the LXC and nspawn capabilities are on level footing, the read
only bind mount was removed.

Change-Id: I62e2c4ed2b3c7af879e58fca1b22c7dda93fc518
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-09-14 23:39:04 +00:00
Kevin Carter d01150301e
Add missing user defined interface support
Macvlan interfaces can have a user defined interface within the host
config. This change ensures that the capability, which is documented in
the nspawn_host role, is actually functional.

Change-Id: I083042a791d9213b9b1872a239dc18dc6c7ae46e
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-08-21 15:51:32 -05:00
Jesse Pretorius 6b0bd02729 Update qgroup setup to be more explicit
The default qgroup setup was setting the qgroup limits to none which
allows the system to dynamical expand or contract. While this works
there can be a lag between the time it takes to grow vs the time it
takes to hit the limit. This change sets the limits accordingly should a
deployer not have a container specific limit set already.

Change-Id: Iea2498bfe1c391f4b4bee295c8f04b2655f404d9
2018-07-19 16:41:42 -05:00
Kevin Carter 9c81caa9a7 Enable network cleanup on role run
The network cleanup Boolean has been enabled to cleanup the network
interface files this role will be responsible for as it creates
containers. This change will ensure the network interface files created
within nspawn containers do not grown uncontrollably or inadvertently
create conflicts.

Change-Id: Idc6f0895eb75c7f5f23f25b701754eb5bbf6163e
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-06-22 06:56:53 +00:00
melissaml c93f3ec6ef Add a single variable for combined networks
The combined networks variable will allow deployers to set basic
container networks, default nspawn networks, and any "extra" networks a
deployer may need outside of a standard build.

Change-Id: I0cfed0ad6cce99c420c31920446e0a69a82fa602
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-05-31 18:11:26 +00:00
Kevin Carter 02169f47ee Limit fact gather post build
We don't need everything the setup module pulls by default.

Change-Id: I404db42bad931520c5832edd3b1bd0468c4f676c
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-05-19 06:22:53 +00:00
Kevin Carter e48838fef3
Use networkd role to setup test networks
The test networks were being setup using networkd and a custom template,
this change updates the process so we're dog fooding.

Additionally change the container config drop so that its executing a
container restart when needed and in the right order.

Several tests were removed because they are basic operations which are
already being tested in the nspawn_hosts role.

Change-Id: I50799d53f8d75f043ed12d4e50da3d55a4ee159a
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-05-19 01:07:06 -05:00
Kevin Carter f3421d7687
Correct contianer network creation and test it
The container network creation process needs to assume that the bridge
name is available and fall back to the interface. Previously this was
being done in reverse.

Change-Id: I51829349b5bc3f97c100a379b13f7e99f4007228
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-05-15 13:31:38 -05:00
Kevin Carter 10146fdf2b
Ensure minimal host facts are present in build
The host may have busted facts for any number of reasons. This change
gathers required facts on the physical_host prior to requiring them.

Change-Id: I0f12bc0b8d5df8840d232853d9aeaecac2688aa6
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-05-14 23:34:02 -05:00
Kevin Carter 32f3ffdcbc
Update role to gate using all supported distros
The changes here remove the boiler plate code we had in favor of using
all of our common roles. This also updates the nspawn role using some of
the learnings we've had from our recent LXC changes and ensures we're
not breaking any compatibility we had with our various distros.

Add option to run a full config update if required

> As a deployer I need the ability to make a sweeping change to container
  configs if required. At present the nspawn container create role will
  attempt to preserve the configs and update only what's required, which
  is desirable when maintaining uptime. This change provides the option
  `nspawn_container_preserve_config` which, if set to "false" will
  template the container configs instead of trying to preserve it.

Document everything in config

Change-Id: Ie969c10578e1102767ad8991c9d6171b547aef87
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-05-14 21:33:05 -05:00
Jesse Pretorius 3840f3584f Improve conditionals to reduce failures
The conditionals based on nspawn_config_exists.stat.exists
fail in some conditions. When the task doing the state does
not execute, there is no dictionary result with the appropriate
structure, causing tasks relying on the structure to fail.

This patch re-arranges the conditionals so that when they
are evaluated, they do so in a better process of elimination.
First, evaluate the same conditional as the stat task, then
validate that the stat dict exists, then check the key in
the stat result.

Change-Id: I6f2d8943c4279edf44907aa145935be858dbc673
2018-03-11 18:29:30 +00:00
Kevin Carter 571028bd84
Remove the block/rescue pattern as it's confusing
The block rescue pattern has been replaced with a stat and slurp set of
tasks with conditionals making it more known to the deployer what is
happening and why.

Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-02-19 16:32:59 -06:00
Kevin Carter 224415abda
generate new machine IDs
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-02-13 23:37:42 -06:00
Kevin Carter 9d976cacb9
Move first start tasks into handlers
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-02-12 09:40:11 -06:00
Kevin Carter 7dbed8d797
correct environment and private networking
This change corrects environment settings and ensures new containers all
use private networking.

Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-02-12 01:25:02 -06:00
Kevin Carter 627d5107cc
First commit
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-02-06 22:37:24 -06:00