211 Commits

Author SHA1 Message Date
Cédric Jeanneret
ee7fbe5963 Ensure we get the right SELinux context for config-data sub-dir
When docker was used, its "create host directory tree" feature was
used. It apparently created directories with "container_var_lib_t"
type, and this prevents podman container to access the content with
AVC errors (permission denied).

The following patch ensures we get a recursive chcon running.

We're using "command" instead of "file" module because ansible doesn't
like broken symlink (in fact, they are symlink with relative path
within containers).

Change-Id: I20d00c79fc898b0c4e535662ee6a70472e075b36
2019-01-03 15:33:36 +01:00
Zuul
795dfcfdce Merge "Replace confusing usage of update_identifier" 2018-12-20 01:51:14 +00:00
Zuul
707cfc90c6 Merge "Remove deploy steps on empty roles" 2018-12-14 22:38:31 +00:00
Cédric Jeanneret
0576e26234 Ensure we get dedicated logging file for HAProxy
With the current configuration, HAProxy logs are in the host journal.
This isn't really friendly when you want to debug issues with this service.

This patches ensures HAProxy logs are in a dedicated file, using the syslog
facility set in its configuration.

Depends-On: I8fee040287940188f6bc6bc35bdbdaf6c234cbfd
Change-Id: Ia615ac07d0c559deb65e307bb6254127e989794d
2018-12-12 10:16:42 +01:00
Thomas Herve
eb3efe7133 Remove deploy steps on empty roles
When a role count is 0, we can create the deployment resources
conditionally.

Closes-Bug: #1671859
Change-Id: I467b9ded1a1b33d520cb69aa86b253a0552643f7
2018-12-12 09:50:36 +01:00
Rabi Mishra
c2aeb45e38 Replace confusing usage of update_identifier
We use update_identifier ansible variable to check if we need to
re-run deployment tasks. Though there is no bug as we use
DeployIdentifier heat param for it, it's little confusing
(UpdateIdentifier was meant for package updates).

This also removes usage of UpdateIdentifier/update_identifier in
all_nodes_config.j2.yaml. We can deprecate/remove the heat param in a
subsequent patch.

Change-Id: I36ed62ae605a2d8f8f139b50646144b143d5e5f4
2018-12-12 09:25:00 +05:30
Zuul
8f5b24de22 Merge "Add ansible python interpreter configuration support" 2018-12-12 00:50:06 +00:00
Zuul
d368217c83 Merge "Remove HostPrepConfig" 2018-12-12 00:50:03 +00:00
Alex Schultz
63a6d4b33f Add ansible python interpreter configuration support
Because we call ansible to run heat to execute ansible for the HostPrep
and RoleConfig, we need to be able to pass the
ansible_python_interpreter to be used for the ansible-playbook execution
via the ansible heat hook.  This change adds an PythonInterpreter
heat configuration than can be used to config it from the default
/usr/bin/python to something like /usr/bin/python3

Change-Id: Idfefe1959e5b95b7d54ce8cb5c2a569225d50847
Related-Blueprint: python3-support
2018-12-10 08:42:58 -07:00
Zuul
570f1da4e3 Merge "Remove common bootstrap_nodeid from deploy_steps/tripleo-packages.yaml" 2018-12-07 16:57:36 +00:00
Emilien Macchi
efa69b734b Remove HostPrepConfig
HostPrepConfig was using the old way (Heat) to run Ansible. We don't
need it anymore thanks to config-download.

It removes some technical debt and reduce our number of interfaces to
configure software.

Change-Id: I2041e6892de76b0ed04d7497e3f9064bfaf58270
2018-12-07 09:10:38 -05:00
Dan Prince
0cbbdac604 Add DockerPuppetMountHostPuppet parameter
This can be used to control whether puppet modules are consumed
from the baremetal host or from the container. Our default
is to consume these from the host so that deployment
archive tarballs can be used to extra puppet modules from
the host.

Since I61e35d8118c1de4c2976f496e8a6c9c529f3d91f we've had
puppet-tripleo in our containers however so using this
location would be possible as well.

Change-Id: I73026e66bcfafd1c582916141b5b1cf0ce0dc36c
2018-11-30 07:39:59 -05:00
Steven Hardy
21905f7588 Remove common bootstrap_nodeid from deploy_steps/tripleo-packages.yaml
There was also a special flag for FFU that triggered repo setup only
on the bootstrap node, so switch this to use the per-service bootstrap
name instead.

Change-Id: I32f963a002399af4911acbf507312f378aac3599
Partial-Bug: #1792613
2018-11-27 15:59:28 +00:00
Zuul
2b9e5d412d Merge "Stop upgrade if a task on one node fails" 2018-11-27 05:42:23 +00:00
Zuul
82a79f3235 Merge "Run docker-puppet.py in debug mode." 2018-11-22 22:11:21 +00:00
Jiri Stransky
021d1b1efb Stop upgrade if a task on one node fails
When we were upgrading multiple nodes at the same time,
e.g. controllers, and a taks on one of the nodes failed, the other
nodes would keep upgrading. This is undersirable and can be fixed by
adding any_errors_fatal to the Ansible plays.

Change-Id: Iad2b5e32e955da41af4d2b8dd8ad8aa1eb5dffa9
Closes-Bug: #1804468
2018-11-21 15:48:53 +01:00
Emilien Macchi
eeb07fcb4a Honor --skip-deploy-identifier in common deploy tasks for updates
To continue the work that was done in
I711dbb00a9c34dbd96ef179ef41bff281b0001d1, we also need to skip the common
deploy tasks if --skip-deploy-identifier is passed by the operator.

When using --skip-deploy-identifier, the UpdateIdentifier is set to
None.
Ansible doesn't see None as "", so we really need to test if the
variable is defined or not. That patches changes the logic to test that.
We also support the case where the variable is set to "", and consider
is as empty which means we want to skip the deploy/updates.
It is also doing it for the update playbooks which includes tasks from
commont deploy.

It is not replicating the exact condition as in deploy_steps_playbook.
There is no need to also check if /var/lib/docker-container-startup-configs.json
file is here because it has been created during the initial deployment.

This fix the bug where --skip-deploy-identifier wasn't honored during
stack updates.

Co-Authored-By: Thomas Hervé <therve@redhat.com>
Co-Authored-By: Sam Doran <sdoran@redhat.com>

Change-Id: Ibab17dcaeebea65135fca4f40562109c90f36c27
Related-Bug: #1796924
2018-11-19 13:53:13 +00:00
Jose Luis Franco Arza
9527808075 Run docker-puppet.py in debug mode.
Allow running docker-puppet.py in
debug mode, depending on the value
of the ansible variable docker_puppet_debug.

This variable takes its value from DockerPuppetDebug,
which is set to true in the env file
environments/config-debug.yaml.

Change-Id: I7c88aa22dce3396c6a79843ac13db479ed987f9d
2018-11-15 11:24:10 +01:00
Quique Llorente
851bd0953a Use correct python version for puppet-docker.py
Now that we are running this at fedora28 with python3 we need to use
python3 to run python scripts at playbooks

Depends-On: I2c471724374da44eeddc4680b268bc362572ee27
Closes-Bug: #1802531
Change-Id: I42b18b228bfe361d19b580a853328c1a6c896257
2018-11-12 06:51:19 +00:00
Emilien Macchi
de798c5947 Use container_cli for post_upgrade_tasks & external_upgrade_tasks
- Export container_cli for post_upgrade_tasks & external_deploy_tasks
  and external_upgrade_tasks
- Replace "docker exec" by {{ container_cli }} exec in these tasks
  (cinder, nova, mysql, ironic and TLS).

Depends-On: Iff509f4dc09862a451ad5cf915aa7764a314c28c
Change-Id: I7b11f44c9255294863879aaff88d0dd1672bff6e
2018-11-05 12:00:46 -05:00
Emilien Macchi
da224f7a9c Export container_cli for update & upgrades & post upgrade tasks
container_cli will be used later by update, upgrade and post upgrade tasks.
This patch is separated from actual tasks, so we can quickly iterate in
multiple patches.

Change-Id: I1ed7dec0019113f1259bce986f354723237f6a25
2018-11-03 03:56:59 +00:00
James Slagle
16dff38eb4 Fix tasks in check mode
These tasks should have check_mode:no set so that they run in check
mode, as the variables they register are used in later tasks. Otherwise,
ansible in check mode fails with undefined variable errors.

Also, some tasks may fail due to not all requirements being available
since those requirements were not created by previous tasks that were
also ran in check mode.

This adds ignore_errors to these tasks, and sets the value to the
boolean ansible_check_mode which is provided by ansible and set based on
whether or not --check was passed to the ansible command line.

Change-Id: I84bc3c14ede37959a4078fd14ce4661b7bd23f84
2018-11-01 19:14:14 +00:00
James Slagle
5a5ad11d0b Add common vars to common plays
We should pass in the common vars to all the common plays in
deploy-steps.j2 so that tasks will have them available. Some of these
parameter driven variables were never actually wired up, so they didn't
work to begin with (such as enable_puppet/enable_debug).

Change-Id: I830e1ae21fe3e278a5f7591065d066c0a6883a9a
Closes-Bug: #1785635
2018-10-25 14:32:17 +02:00
Zuul
0797f537dc Merge "check mode: paunch configs" 2018-10-20 08:01:47 +00:00
Zuul
557e69c0dc Merge "check mode: docker_puppet_tasks" 2018-10-20 08:01:45 +00:00
Jill Rouleau
fc30066a35 Add stack output ansible_group_vars
This change adds a stack output to services/common.yaml that acts
as an interface for Ansible group variables.  Ansible vars provided
via this interface will be consumed by config-download and written
under $config-download-dir/group_vars/ where they can be accessed
by ansible commands.

Part of blueprint ansible-tasks-to-role.

Change-Id: Ib70e7dda13b4a3ed30af88906ba42c25cdc93038
2018-10-17 16:44:50 +00:00
Zuul
94943cfff9 Merge "Introduce proper steps to external update/upgrade tasks" 2018-10-17 15:03:47 +00:00
Zuul
c262998fcf Merge "check mode: docker_puppet" 2018-10-16 23:12:05 +00:00
Zuul
cac9d17663 Merge "Remove references to logging_source" 2018-10-13 09:06:39 +00:00
Zuul
52960f30dc Merge "Honor --skip-deploy-identifier in common deploy tasks" 2018-10-12 01:00:28 +00:00
Cédric Jeanneret
245da47a9d Add SELinux configurations for a proper Standalone deploy
With this patch, we're able to deploy a "standalone" stack using
podman on a fully-enabled SELinux system.

Change-Id: I4bfa2e1d3fe6c968c4d4a2ee1c2d4fb00a1667a1
2018-10-10 11:57:21 +00:00
James Slagle
a7955832df Honor --skip-deploy-identifier in common deploy tasks
To match the previous functionality when not using config-download, the
common deploy step tasks should be skipped for already deployed nodes
when using --skip-deploy-identifier.

This patch adds a task to check if one of the json configuration files
created by the common tasks already exists. If it does, and
--skip-deploy-identifier has caused an empty DeployIdentifier parameter
value, the tasks will be skipped for that node.

Change-Id: I711dbb00a9c34dbd96ef179ef41bff281b0001d1
Closes-Bug: #1796924
2018-10-09 11:55:13 -04:00
Juan Antonio Osorio Robles
cb3c72f37d Remove references to logging_source
This has been unused for a while, and even deprecation was scheduled
(although the patch never merged [1]). So, in order to stop folks
getting confused with this, it's being removed.

[1] https://review.openstack.org/#/c/543871/

Change-Id: Iada64874432146ef311682f26af5990469790ed2
2018-10-08 13:43:47 +03:00
Jiri Stransky
bcd6cde608 Introduce proper steps to external update/upgrade tasks
So far the tasks for external update/upgrade were not using the step
mechanism as other tasks, we had a single step. As external
deploy/update/upgrade tasks are being used for more things nowadays,
it's likely that we'll need to go towards a similar model like we have
for deploy/update/upgrade tasks -- proper usage of steps.

For now we have just 2:

* Step 0 for setting global facts, and performing validations.

* Step 1 for actual update/upgrade tasks. (There's an upcoming change
  to run online data migrations in step 1).

Change-Id: I1933bd0eedab71caab56c0e5d93ba7927fb7c20f
Partial-Bug: #1793332
2018-10-04 12:08:21 +02:00
James Slagle
b76a36eca1 check mode: paunch configs
Adds initial check mode support for the paunch container startup
configuration and kolla config files. This cleans up the formatting of
the generated files so that the diff shown duing check mode with --diff
is useful.

We can't actually run paunch during check mode as it doesn't yet have
any support for a dry run mode.

Change-Id: I9add7b9fda50847c111e91735bd55a1ddf32f696
2018-10-03 07:47:20 -04:00
James Slagle
29f05e1e6f check mode: docker_puppet_tasks
Adds check mode support for docker_puppet_tasks.

Since it's not possible to reliably determine what these tasks do, we
can't actually run them to get an idea of what might be changed. We can
however show the diff of the json file to get an idea of what would be
run.

Change-Id: I19e8bc9eb93d8acc8ee7d737770f9cc7e63f7a27
2018-10-03 07:47:20 -04:00
James Slagle
a6f9821821 check mode: docker_puppet
Adds check mode support for docker_puppet. The updated json file is
written to /var/lib/docker-puppet/check-mode/docker-puppet.json
during check mode and then diffed with the existing version at
/var/lib/docker-puppet/docker-puppet.json.

When docker-puppet.py is run during check mode, the updated json file
under the check-mode directory is passed to the command. All generated
config files are then written under /var/lib/config-data/check-mode,
which is then recursively diffed with the existing config under just
/var/lib/config-data to report on all changed config files.

Change-Id: I5c831e9546f8b6edaf3b0fda6c9fbef86c825a4c
2018-10-03 07:47:16 -04:00
James Slagle
6d0f16d430 check mode: puppet host
Adds check mode support for puppet host tasks.

This works by writing the new puppet host manifest under
/var/lib/tripleo-config/check-mode, and diffing it against the existing
version of the manifest.

Puppet is also run with --noop, so that it only reports on what changes
would have been made.

It also uses the check mode hiera configuration at
/etc/puppet/check-mode/hiera.yaml if it exists so that the updated hiera
data is also accounted for when puppet runs with --noop.

Depends-On: Ibe0c2ab79c35f04ce51e7a1ade0e8ff72b430163
Change-Id: I112b63096c8dce05176b0939a7678bec02987294
2018-10-01 13:59:59 -04:00
James Slagle
1b0c827930 Convert with_dict tasks to use loop and be less chatty
with_dict is replaced by ansible's loop:
https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#with-dict

This migrates tasks using with_dict over to use loop instead.

Additionally, when using loop (or with_dict), the entire loop item is
logged by default. This makes these tasks very verbose since we're
looping over large json/yaml files. Instead, use loop_control and label
ot only log the item key. The entire data structure already exists in
the config-download directory anyway, so there's no need to log the
whole thing to the console.

Change-Id: I1fc7431dfc662212b6ca64f4f738760f25b0c30b
2018-10-01 13:59:59 -04:00
Zuul
e516e8bfec Merge "Tag tasks in in common tasks" 2018-09-28 11:37:13 +00:00
Zuul
fd52b25c8b Merge "Remove "when failed" from debug task names" 2018-09-28 00:54:50 +00:00
Zuul
ebbfee9516 Merge "Tag step plays" 2018-09-28 00:54:48 +00:00
Cédric Jeanneret
57154fd084 Dropped "recurse" for idempotency
We should not need that recurse anyway.

Change-Id: I504b52a2bb3c89e75ac3402f259c317889c054e6
Closes-Bug: #1794251
2018-09-25 13:20:12 +02:00
James Slagle
961fdc22ee Tag tasks in in common tasks
Adds the following tags to relevant tasks in deploy-steps-tasks.yaml
that are common to all roles:

- host_config
- container_config
- container_config_tasks
- container_config_scripts
- container_startup_configs

The tags are tool agnostic, so hopefully they won't have to be updated
over time. They allow users to run only specific parts of the common
tasks.

Change-Id: Ia7476da222218411caddae887f99c029b4bccf23
2018-09-24 09:21:53 -04:00
James Slagle
13aaf52a46 Remove "when failed" from debug task names
This commit removes the "when failed" from the task title to eliminate
confusion.

These tasks always run to show the debug output for the previous task,
regardless of whether the the previous task failed or not. They will
show the debug output as long as the previous task finished (success or
failure).

Change-Id: I4e52bdc18885f13793550e5032fb1316a13b248c
2018-09-24 09:17:15 -04:00
James Slagle
bf6efb06c7 Tag step plays
This adds a tag step[1-5] to each of the plays within the jinja2 loop to
create our 5 deployment steps. Using these tags, it's possible to run
these plays individually if desired.

Change-Id: Ic705afbf174b4597d98c2b83041ff88dd8d6664c
2018-09-24 09:17:15 -04:00
Cédric Jeanneret
7719263c27 Ensure some directories are created with the correct SELinux label
As Podman doesn't create host location for bind-mount, we have to ensure
directories actually exists.
SELinux labels are also important, since Podman has selinux enabled by default,
and there is currently no way to disable it like in Docker.

Change-Id: Ic1bede203e8199a296944273cb334027dab940fe
2018-09-21 22:11:11 +00:00
Zuul
85da81624f Merge "Remove references to logging_group" 2018-09-19 08:01:19 +00:00
Emilien Macchi
e175e5ab2f Initial support for Podman in docker-puppet
Create a new parameter in TripleO: ContainerCli.
The default is set to 'docker' for backward compatibility but it allows
to also set to 'podman'.
When podman is selected, the right commands will be run so docker-puppet
can configure the containers when Podman is the selected container
library backend.

It removes the tripleo_logs:/var/log/tripleo/ mount that was used
by tripleo-ui but we shouldn't do that here. We'll create a bind mount
in tripleo-ui container later.

It run puppet with FACTER_hostname only if NET_HOST is disabled.

Change-Id: I240b15663b720d6bd994d5114d43d51fa26d76cc
Co-Authored-by: Martin André <m.andre@redhat.com>
2018-09-08 05:23:00 +00:00
Zuul
639a043f0d Merge "Allow performing Ceph update/upgrade separately" 2018-09-04 23:04:41 +00:00