Commit Graph

25 Commits

Author SHA1 Message Date
Damian Dabrowski 2de5a8a1a0 Add TLS support to cinder backends
By overriding the variable `cinder_backend_ssl: True` HTTPS will
be enabled, disabling HTTP support on the cinder backend api.

The ansible-role-pki is used to generate the required TLS
certificates if this functionality is enabled.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/879085
Change-Id: Ib682499e900071db38cc2fd7c30822d0c33dba38
2023-04-29 18:36:09 +02:00
Dmitriy Rabotyagov 92aba932b1 Ensure service is restarted on unit file changes
At the moment we don't restart services if systemd unit file is changed.

We knowingly prevent systemd_service role handlers to execute
by providing `state: started` as otherwise service will be restarted twice.
With that now  we ensure that role handlers will also listen for systemd
unit changes.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/879671
Change-Id: I8140add1a4e4fdacee89bd29bd2e3c87eff0953a
2023-04-07 09:53:38 +00:00
Dmitriy Rabotyagov f3b2abb887 Remove mention of haproxy-endpoints role
Role was never migrated to usage of haproxy-endpoints role
and included task was used instead the whole time.
With that to reduce complexity and to have unified approach, all mention
of the role and handler are removed from the code.

Change-Id: I0c055393ccb1c8d61affc2c1bb6d01f0c329afe9
2022-06-14 18:02:35 +00:00
Jonathan Rosser a9eec797b7 Remove legacy policy.json cleanup handler
Change-Id: Icc44bcf02229ad7d18853a47924b4aa3d3d1b7cd
2022-02-02 04:08:44 -05:00
Dmitriy Rabotyagov 6b5a93edb9 [goal] Deprecate the JSON formatted policy file
As per the community goal of migrating the policy file
the format from JSON to YAML[1], we need to replace policy.json to
policy.yaml and remove deprecated policy.json.

[1]https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html

Change-Id: Iede5a9f0387baaf9c72bd060b59435ffaa76f1bd
2021-03-30 16:43:53 +00:00
Jonathan Rosser a4653722ed Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I299e71fac6efdb89655bd36de72b95400d7000aa
2021-02-23 18:04:29 +00:00
Kevin Carter f3f956e904 Cleanup files and templates using smart sources
The files and templates we carry are almost always in a state of
maintenance. The upstream services are maintaining these files and
there's really no reason we need to carry duplicate copies of them. This
change removes all of the files we expect to get from the upstream
service. while the focus of this change is to remove configuration file
maintenance burdens it also allows the role to execute faster.

  * Source installs have the configuration files within the venv at
    "<<VENV_PATH>>/etc/<<SERVICE_NAME>>". The role will now link the
    default configuration path to this directory. When the service is
    upgraded the link will move to the new venv path.
  * Distro installs package all of the required configuration files.

To maintain our current capabilities to override configuration the
role will fetch files from the disk whenever an override is provided and
then push the fetched file back to the target using `config_template`.

Change-Id: Ib3447cd5b0bcada4cdf82d9e4a9fe5160299f9c3
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
Signed-off-by: Kevin Carter <kevin@cloudnull.com>
2019-01-19 18:02:51 -06:00
Jesse Pretorius 7d3a797c2c Use a common python build/install role
In order to radically simplify how we prepare the service
venvs, we use a common role to do the wheel builds and the
venv preparation. This makes the process far simpler to
understand, because the role does its own building and
installing. It also reduces the code maintenance burden,
because instead of duplicating the build processes in the
repo_build role and the service role - we only have it all
done in a single place.

We also change the role venv tag var to use the integrated
build's common venv tag so that we can remove the role's
venv tag in group_vars in the integrated build. This reduces
memory consumption and also reduces the duplication.

This is by no means the final stop in the simplification
process, but it is a step forward. The will be work to follow
which:

1. Replaces 'developer mode' with an equivalent mechanism
   that uses the common role and is simpler to understand.
   We will also simplify the provisioning of pip install
   arguments when doing this.
2. Simplifies the installation of optional pip packages.
   Right now it's more complicated than it needs to be due
   to us needing to keep the py_pkgs plugin working in the
   integrated build.
3. Deduplicates the distro package installs. Right now the
   role installs the distro packages twice - just before
   building the venv, and during the python_venv_build role
   execution.

Depends-On: https://review.openstack.org/598957
Change-Id: Ica126c4ae20d2a7972a9309147cf6db902343bbf
Implements: blueprint python-build-install-simplification
Signed-off-by: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
2018-09-03 11:11:05 +00:00
Jean-Philippe Evrard bf9a1c19fa Fix usage of "|" for tests
With the more recent versions of ansible, we should now use
"is" instead of the "|" sign for the tests.

This should fix it.

Change-Id: Ifec8022a02b0a5f259cadf5eb65ab74c51df3e73
2018-07-16 12:26:09 +02:00
Jimmy McCrory 9cbff60731 Use listen instead of chained notifiers
From Ansible 2.2 onwards, listen can be used for
handlers instead of chaining notifiers. The
handlers are then executed in the sequence
present in the handler file.

Change-Id: Ibe45c76826f9d9830e1315417f336c2d7e23150c
2018-03-17 14:06:54 -07:00
Logan V 5108e06793 Add external LB management handler hook interface
Based on conversation on an ansible issue[1], I implemented
a LB orchestration role[2] similar to the POC here[3].

This will allow external loadbalancer management roles to hook
into a universal notify listener "Manage LB" to perform before/
after endpoint management actions when the service is being
restarted.

[1]: https://github.com/ansible/ansible/issues/27813
[2]: https://github.com/Logan2211/ansible-haproxy-endpoints
[3]: https://github.com/Logan2211/tmp-ansible-27813

Change-Id: I19818234d9c8a5ad90b6387c360d598fda03a65e
2017-09-16 13:54:06 -05:00
Jesse Pretorius b98100fe0c Ensure that services restart in a particular order
Currently when multiple services share a host, the
restart order is random. This is due to an unordered
dict being used to facilitate the mapping of services
to their groups, names and other options.

Based on [1], this patch implements changes to the role
to ensure that services on the same host are restarted
in the correct order when the software/config changes.

[1] https://docs.openstack.org/developer/cinder/upgrade.html#minimal-downtime-upgrade-procedure

Change-Id: If5729671cb69f928df660ec2d9ba83fe3f567946
2017-06-19 12:25:27 +00:00
Jesse Pretorius f2ed992208 Filter services dictionary per host
To greatly reduce the amount of log noise from skipped tasks, set a
var in the role that filters the 'nova_services' dict to one that only
contains services relevant for each host.

Change-Id: I38ab4345f06ba6c9ef45cfe8e3ef48f2328b2333
2017-06-02 17:23:45 +01:00
Jesse Pretorius fb807f2a60 Perform an atomic policy file change
The policy.json file is currently read continually by the
services and is not only read on service start. We therefore
cannot template directly to the file read by the service
(if the service is already running) because the new policies
may not be valid until the service restarts. This is
particularly important during a major upgrade. We therefore
only put the policy file in place after the service restart.

This patch also tidies up the handlers and some of the install
tasks to simplify them and reduce the tasks/code a little.

Change-Id: Ia9df064ff145bec862e2a2cc0fd180a9188c5238
2017-05-24 10:42:15 +01:00
Cuong Nguyen 492e2394d4 Use systemd module instead of shell
Using ansible systemd module to daemon reload and service reload is the solution for the future.

Change-Id: If2e4c74ebf8a28d5a777c404cfcc179db32de3f3
2017-01-24 09:51:15 +07:00
Andy McCrae 6683a8db26 Remove Trusty support from os_cinder role
Change-Id: I1959caae206dab450e50dd6f9d7a11137f1d8281
Implements: blueprint trusty-removal
2016-12-15 13:16:08 +00:00
Logan V b621c711e8 Fix linting issues for ansible-lint 3.4.1
Preparing this role for the ansible-lint version bump

Change-Id: I5d38c3eb0f7fdf98d9114e692cad9ad36127ac44
2016-11-02 02:51:11 +00:00
Jesse Pretorius (odyssey4me) f93a5186aa Revert "Add retries to upstart/systemd reload"
This reverts commit 0986fa15d4.

This did not help at all and it actually ends up slowing down
the deployment. The real problem was resolved in subsequent
patches so I think it's better to remove this.

Change-Id: Ie1b492ea38a17dcaefd309f9e56feeda80ca96ee
2016-10-14 13:38:40 +00:00
Jesse Pretorius 0986fa15d4 Add retries to upstart/systemd reload
Sometimes the subsystem fails to restart due to what
looks like a race condition in the kernel scheduler.

This patch makes Ansible try a few more times before
failing.

Change-Id: Id6e51c52d2711c36c7b292dbae16654774c24540
2016-10-01 03:00:28 +00:00
Jesse Pretorius 4888d5a5d1 Updating service group mapping implementation
This patch updates the work done in https://review.openstack.org/377055
to match up to the implementation in https://review.openstack.org/378613
which aims to bring the implementation in line with the os_neutron
role.

- The variable ;cinder_service_names; is renamed to 'cinder_services'.
- Common variables shared by each service's template files have
  been updated to use the service namespaced variables.
- Unused handlers have been removed.
- Unused variables have been removed.
- The handler to reload the services now only tries to restart the
  service if the host is in the group for the service according to the
  service group mapping. This allows us to ensure that handler
  failures are no longer ignored and that no execution time is wasted
  trying to restart services which do not exist on the host.
- Currently the reload of upstart/systemd scripts may not happen if
  only one script changes as the task uses a loop with only one result
  register. This patch implements handlers to reload upstart/systemd
  scripts to ensure that this happens when any one of the scripts
  change.

Change-Id: Icca1f3ef930962c1179687b1a7ef4dcce5ca47f2
2016-09-29 07:52:02 +01:00
Jimmy McCrory c84f90a298 Use dictionary for service group mappings
Change the 'cinder_service_names' from a list to a dictionary mapping of
services, groups that install those services, and any additional
conditions around their installations. The init tasks have been updated
to run once and loop through this mapping rather than being
included multiple times and re-run against each host. This may
potentially reduce role run times.

Common variables shared by each service's template files have also been
updated to use the service namespaced variables.

Change-Id: Ifeb890cc733921a6f882e4d9cdb778e22c82e9c5
2016-09-26 16:29:37 -07:00
Marc Gariepy f420900880 Add centos support for os_cinder role
Add basic centos support for cinder role

Change-Id: I21f84809c44ac4be0165fadfb8da67bbcbc9b05c
2016-09-23 13:48:06 +00:00
Travis Truman 3e0214ff18 Ansible 2.x - Address deprecation warning of bare variables
Ansible 2.2 will not allow "bare" variable references
in with_* loops. See https://docs.ansible.com/ansible/porting_guide_2.0.html#deprecated
for details.

Change-Id: I4fda03a3f403e6b3b491365a2473caafff4d3843
2016-04-20 16:12:04 -04:00
Ryan Moore ad25df832d Style - Not in YAML dictionary format
Depends-On: I2271fe8468840884f19f41abba37e696c6296350
Change-Id: I5829e60e85c8c5671edfcd28f5be0c0912dd30a0
2016-02-12 15:26:42 +00:00
Kevin Carter 1cd0bdff52 Convert existing roles into galaxy roles
This change implements the blueprint to convert all roles and plays into
a more generic setup, following upstream ansible best practices.

Items Changed:
* All tasks have tags.
* All roles use namespaced variables.
* All redundant tasks within a given play and role have been removed.
* All of the repetitive plays have been removed in-favor of a more
  simplistic approach. This change duplicates code within the roles but
  ensures that the roles only ever run within their own scope.
* All roles have been built using an ansible galaxy syntax.
* The `*requirement.txt` files have been reformatted follow upstream
  Openstack practices.
* Dynamically generated inventory is now more organized, this should assist
  anyone who may want or need to dive into the JSON blob that is created.
  In the inventory a properties field is used for items that customize containers
  within the inventory.
* The environment map has been modified to support additional host groups to
  enable the seperation of infrastructure pieces. While the old infra_hosts group
  will still work this change allows for groups to be divided up into seperate
  chunks; eg: deployment of a swift only stack.
* The LXC logic now exists within the plays.
* etc/openstack_deploy/user_variables.yml has all password/token
  variables extracted into the separate file
  etc/openstack_deploy/user_secrets.yml in order to allow seperate
  security settings on that file.

Items Excised:
* All of the roles have had the LXC logic removed from within them which
  should allow roles to be consumed outside of the `os-ansible-deployment`
  reference architecture.

Note:
* the directory rpc_deployment still exists and is presently pointed at plays
  containing a deprecation warning instructing the user to move to the standard
  playbooks directory.
* While all of the rackspace specific components and variables have been removed
  and or were refactored the repository still relies on an upstream mirror of
  Openstack built python files and container images. This upstream mirror is hosted
  at rackspace at "http://rpc-repo.rackspace.com" though this is
  not locked to and or tied to rackspace specific installations. This repository
  contains all of the needed code to create and/or clone your own mirror.

DocImpact
Co-Authored-By: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
Closes-Bug: #1403676
Implements: blueprint galaxy-roles
Change-Id: I03df3328b7655f0cc9e43ba83b02623d038d214e
2015-02-18 10:56:25 +00:00