Commit Graph

282 Commits (8cfe4d399ae0a8a3d613be4cc5f29ef4157fd974)

Author SHA1 Message Date
Zuul 3c962d9cc9 Merge "Expose tripleo_container_manage_clean_orphans var" 3 years ago
Rabi Mishra 1b93165288 Expose tripleo_container_manage_clean_orphans var
This exposes new var for tripleo_container_manage. Also,
removes the check to force set clean_orphans=True in
needs_delete filter, when there is one or no item in
the startup config.

There is a possibility when disabling services, there would
be one or zero container_startup_configs for a step.

Partial-Bug: #1893335
Change-Id: I9d08168015487c48d8b380a9575ba236b7fb7d0d
3 years ago
Alex Schultz 5702b7ba3d Add tripleo_diff_exec module
This module takes a file input and checks to see if it has changed since
the last time checked and runs a command if it has changed. The module
will take a copy of the file being checked to be used for subsequent
executions if the file has changed.

Change-Id: Iea02a40639529ff9d80d3368f07ce81e6b1e911f
3 years ago
Zuul c33af2bbe7 Merge "Update containers info module from collection" 3 years ago
Zuul c885911608 Merge "Show the proper value (0) to set unlimited pids" 3 years ago
Takashi Kajinami 42f32b21e3 Show the proper value (0) to set unlimited pids
According to podman documentation[1], 0 should be set to --pids-limit,
instead of -1, to allow unlimited pids.


Change-Id: Ica40c727d864f941cde7104f3259edf8bb05f081
3 years ago
Sagi Shnaidman 72f0e09019 Update containers info module from collection
When container disappears between "podman ps -a" call and
inspection call "podman inspect cont1 cont2, ..", the module fails.
To avoid this run inspection of each container one by one if total
inspection call failed.
This is update of module from collection.
Closes-Bug: #1892701

Change-Id: I0c085c6c136e5d5b162feb8a1f72d906ab08502e
3 years ago
Brent Eagles 3220e4e5e3 Add OpenFlow10 to protocols for backwards compatability
We need to add OpenFlow10 to the required protocols to support
backwards compatibility with neutron's destroy_patch_ports.

Closes-Bug: #1892491
Change-Id: I6865787f4d0b0459ac2eb91c0f1da9c08b36dd8d
3 years ago
Zuul 0a8b55efa4 Merge "tripleo_container_configs module" 3 years ago
Zuul e2716db951 Merge "Create tripleo_container_config_scripts module" 3 years ago
Zuul 23e25d9e15 Merge "Wait for node to be unlocked before provide" 3 years ago
Emilien Macchi bfc2681ad5 tripleo_container_configs module
To replace the task that looks over kolla_config.yaml and creates the
json files per item in the YAML, create a module that will lead to one
task creating all the files.

Change-Id: I19d8b8c3bc37cca6fb2c9e535e70b43dabef58d6
3 years ago
Emilien Macchi b6f979ca1e Create tripleo_container_config_scripts module
This module will help to simplify the task that creates the container
config scripts, generated via config download.

It'll replace the loop in THT that iterate over a file to create the
scripts and their content, and executer faster on module.

Change-Id: I4bbd54d193271daa10383b8cb48c9ea9aa0b5b74
3 years ago
Steve Baker 99b06ea3a2 Wait for node to be unlocked before provide
This change reduces the risk of provide having a lock timeout by
waiting for existing node locks to be released before starting the

Ansible based provide may not be affected by bug #1846791 because
power-down happens after the provide, not before. However waiting for
locks to be released is recommended practice, and doing it here may
improve reliability.

Change-Id: I5bced3b91e4fa3568185e2bbc85c0a000182394e
Closes-Bug: #1846791
3 years ago
Rabi Mishra 93cb472162 Add ansible module for container image prepare
This adds a new ansible module for container image prepare
and changes the role to use the module instead.

Change-Id: I1cfa68c74eb772ddf794c53827fd9bea1fe2e5a3
3 years ago
Maciej Józefczyk 29993d43b3 Set the OpenFlow protocol while upgrading OVS from 2.11
We noticed a bug in OSP that OVN controller (2.13) was unable to
contact to OVS bridge (2.11).
Before running the update we should set the OpenFlow protocols on
integration bridge (br-int).

More about the issue [1].


Change-Id: I575d67521719ae3908777284b4225eff5169ae6b
3 years ago
Zuul 3bebb34df3 Merge "Create an action plugin for podman_container module" 3 years ago
Zuul 05d16a8c6e Merge "helpers: fix pep8 issues" 3 years ago
Zuul 9f9cc8a651 Merge "Refetch task" 3 years ago
Emilien Macchi a671a7c7e1 helpers: fix pep8 issues
Fix some pep8 issues with too-long lines in our filters.

Change-Id: Ib0d52c68245af9cbc579126920cca07a2db102ac
3 years ago
Alex Schultz ccb5cde76f Refetch task
When we grab the task to execute, use the one we fetch to advance the
host rather than the peeked version.

Change-Id: If8f53f900070bb714662e519b4017d963af30ccc
3 years ago
Sagi Shnaidman 86f1746120 Create an action plugin for podman_container module
When we want to create a large set of containers at the same time, an
action plugin can now be used which will call the podman_container

The podman_containers action plugin takes a list of containers with
pre-defined parameters ready to be consumed by the podman_container

The podman_containers module is just useful for Ansible documentation.

The molecule tests will ensure that the action plugin actually works and
creates the 3 containers.

Change-Id: I1e6881f3871a7a125db9374c608ecad0bafcb882
3 years ago
Zuul 01b48fa753 Merge "Add tripleo_ovs_upgrade module." 3 years ago
Zuul 7de844981e Merge "tripleo_states: change wording" 3 years ago
Sofer Athlan-Guyot 6344bbb43d Add tripleo_ovs_upgrade module.
This module replace the code in [1] as we need to replicate this
sequence of actions in several places in the templates.

It first checks if it's a layered product ovs update which uses
rhosp-openvswitch.  If so, it makes sure that openvswitch is removed
without triggering any actions, like stopping the service.  Then we
install the rhos-openvswitch package which will take care of updating
everything without disturbance.

If the os is not using layer product, then we download the openvswitch
and update it without triggering the systemctl restart if present in
the postun scripts.


Change-Id: I793bdb8db1d34011cf64cf9942a811ab5efc00ed
3 years ago
Emilien Macchi f1969830e0 tripleo_states: change wording
Change the wording to replace "This or these node(s) failed to deploy"
by "The following node(s) had failures:"; failures can happen at a
different level (not necessarily deploy). Update the wording to avoid
any confusion.

Change-Id: I80041738df05dbe0da678efa91e861390ad4657e
Related-Bug: #1889212
3 years ago
Zuul 83bb2e3f03 Merge "Fix parameter_defaults for nova less deploy" 3 years ago
Rabi Mishra d958b45ebb Fix parameter_defaults for nova less deploy
We seem to be using incorrect parameters for HostnameFormat and
Count when generating environment for nova less deploy.

It's always {{}}Count and {{}}HostnameFormat

Change-Id: I59233aeb488ae3938128d0ed6b86649a671ba526
3 years ago
Emilien Macchi 67d78a753c container_systemd: improve debugging if service never starts
If a service never starts, the "status" key won't exist so Ansible
raises with KeyError which is very misleading (we don't even have the
service name).

This make pass the KeyError exception, so we fail at the end of the loop
of attempts with proper Ansible raise and we give the service name.

Change-Id: I74f3d5b51bde1ec33b69b2488174eef9cc4a330d
3 years ago
Emilien Macchi ddf494a16d tripleo_container_manage: start systemd services which would be stopped
If an operator would have disabled or stopped the service, we make sure
that it is again enabled and started when a deployment occurs.

We also add test coverage for it in molecule.

Change-Id: I97a6819574772835eb4a291b63bb05551fe4439a
3 years ago
Emilien Macchi ca8fae62e4 tripleo_container_manage: continue to reduce tasks
1) shutdown: include tasks without a block. this should remove the stat
   and include task; to only have one task that include the shutdown
   playbook if needed.

2) Remove containers_changed tasks. This is not useful to restart a
   container just because its podman_container resource changed.
   when podman_container module applies a change to the container, this
   one is already restarted.

3) Remove all_containers_commands tasks, there aren't needed. Ansible
   output already provides the commands that are run via the
   container_status module.

Change-Id: Ic625bc5dd7bbd964d36eab0a3f81eca31c533716
3 years ago
Zuul 7ffb084b2a Merge "Allow any_errors_fatal to be dynamic" 3 years ago
Alex Schultz 28d4e52a16 Allow any_errors_fatal to be dynamic
Currently any_errors_fatal cannot be dynamic value based on the current
task vars. This change attempts to evaulate the provided value and
verifies it's a boolean when using it to handle the any_errors_fatal

Related Upstream:
Related-Bug: #1887702

Change-Id: I31cf042b72aad5cdd2c7c1ae8bc319eca372acff
3 years ago
Steve Baker 3ba91a22a4 Capture metalsmith python logging
The metalsmith_instances module calls into metalsmith and there is
currently no logging mechanism to see what is happening. This change
is an attempt to improve this by configuring logging and adding the
output to the result dict as 'logging'.

Change-Id: I3da2e72383787f96bf4d930e416b8fb5c0a4ff72
Related-Bug: #1879472
3 years ago
Zuul 4e0293e4c9 Merge "container_status: "exec" checks status" 3 years ago
Emilien Macchi 1f3ecf2a85 container_startup_config: remove old startup config files
These files aren't needed anymore, since we generate one JSON per
container in its step directory.
We now make sure these files don't exist so there is no confusion.

Change-Id: I9674102d6b3686206eec78f8d6f4408988a69b7b
3 years ago
Zuul 940745b8fc Merge "container_systemd: improve logging" 3 years ago
Zuul a1953193c6 Merge "tripleo_states: add missing space" 3 years ago
Emilien Macchi 3ce9d50a7f container_status: "exec" checks status
Support the checks of "podman exec" commands, and add the commands to
the list of things podman ran.

It reduces the number of tasks as it removes get_commands_exec and
re-use the container_status action plugin.

Change-Id: I4c84b389b595a8fe18ef6d31e896d6b6608b9920
3 years ago
Emilien Macchi 32bc4a4639 container_systemd: improve logging
Change the wording when a container will be added to the list of
containers that will be restarted, so it's not confusing.

Change-Id: Ieb50138b5c1d35fa3c59dd368a58c1af3f61807b
3 years ago
Emilien Macchi abb6ac6177 tripleo_states: add missing space
add missing space so the output ~~~~ is aligned with the rest.

Change-Id: I95fd1fa07ffe6824886946d44b488d93b3e52d55
3 years ago
Sagi Shnaidman 15818924b1 Update podman_container with better idempotency
Add image inspection, idempotency for ulimits, workdir, user,
other image overriden parameters.
Add idempotency for volumes, published ports, others.
Small improvements for docs.
Change-Id: I01011e451827387f70d505242811e896a3a8ad4d
3 years ago
Sagi Shnaidman 1804a43d86 Fix introspection restart with unlocking node
Use wait_for_node_reservation method from cloud.baremetal class,
not from cloud.baremetal_introspection.

Change-Id: Iaf2d410a2da74f062f1ad0de49c76beba8548f9a
3 years ago
Zuul bd02601809 Merge "Introduce an Action Plugin to manage systemd services for containers" 3 years ago
Zuul 68970db225 Merge "Introduce an Action Plugin to fetch container infos" 3 years ago
Emilien Macchi af7f083066 Introduce an Action Plugin to manage systemd services for containers
Instead of running a bunch of tasks to manage systemd resources, move
it into an action plugin which should make the execution faster and
easier to debug as well.

Example of task:
- name: Manage container systemd services
      - keystone:
          restart: always
      - mysql:
          stop_grace_period: 25
          restart: always

The output is "restarted" for the list of services that were actually
restarted in systemd.

Note on testing: since that module is consummed by
tripleo_container_manage role, there is no need to create dedicated
molecule tests, we already cover containers with restart policy in that
role's molecule tests. So we'll re-use it.

Co-Authored-By: Alex Schultz <>
Co-Authored-By: Kevin Carter <>

Change-Id: I614766bd9b111bda9ddfea0a60b032e1dee09abc
3 years ago
Zuul 8611af0a92 Merge "Add a new callback: tripleo_states" 3 years ago
Emilien Macchi 19774d0be4 Introduce an Action Plugin to fetch container infos
Instead of running a bunch of tasks to figure out what container
commands have been run, which ones did not terminate after 5 minutes,
which ones failed or finished with a wrong exit code. We now have an
action plugin that will do it faster and with better logging.

Faster before it reduces the number of tasks.
Better logging is provided, now displaying all errors during a run and
fail at the end.

Supporting check-mode.

Re-using tripleo_container_manage role for molecule testing.

Co-Authored-By: Alex Schultz <>
Co-Authored-By: Kevin Carter <>

Change-Id: Ie7f8c9cceaf9540d7d33a9bb5f33258c46185e77
3 years ago
Emilien Macchi 76bb504762 Implement container_startup_config module
container_startup_config will replace a bunch of tasks that we did in
THT to generate the .json file for each container in

It'll accelerate a bit the deployment by replacing tasks into a
single module, so we can generate the startup configs much faster.

Also tolerate empty configs in container_config_data, switching a
failure into a debug. If the config is empty, there is no need to run
the rest of the role tasks in tripleo_container_manage.

Note: we manage the SElinux context at the openstack-selinux:

TODO (later): Manage idempotency and only create configs that need to be

Change-Id: I501f31b52db6e10826bd9a346d38e34f95ae8b75
3 years ago
Alex Schultz 2232a27ffb Use filter for containers not running check
Rather than using ansible task loops which increase the time to execute,
this change creates a filter that is used to assert that the containers
used in execs are running before we run the execs

Change-Id: I5e15cc71c45160109f5c303c13dd25a052ede3c3
3 years ago