Commit Graph

13 Commits

Author SHA1 Message Date
Damian Dabrowski 0964f87c69 Add TLS support to heat backends
By overriding the variable `heat_backend_ssl: True` HTTPS will
be enabled, disabling HTTP support on the heat 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: Ifb904adc61f1461e646c3fce0bd062f526b8e446
2023-04-29 18:37:10 +02:00
Dmitriy Rabotyagov 5061ec247c 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-plugins/+/880028
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/880031
Change-Id: Id9540fe5f7577ebbc222a1ae303b16338a1f071b
2023-04-11 11:11:24 +00:00
Jonathan Rosser 42fadbc03f Remove legacy policy.json cleanup handler
Change-Id: Ic78fa04baba562f20a7e2288e0834fb3eb825503
2022-02-02 04:13:11 -05:00
Dmitriy Rabotyagov 5a8cd45701 [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.

config_template has been choosen instead of the copy, since it can
properly handle content that has been lookuped.

We make a separate task not to restart service when it's not needed.

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

Depends-On: https://review.opendev.org/c/openstack/heat/+/766861
Change-Id: I3d1c51a025f2c94cb02f7e0882472344dcb97fa4
2021-03-24 12:12:10 +00:00
Jonathan Rosser 2dc4709537 Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I70349036d45f44b7d951224fa2d27fe417301d87
2021-03-16 08:04:15 +00:00
Jesse Pretorius 827a1d1440 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: I7660ab1cff41a74eca84b8e3fbc1a8f6f1af032b
Implements: blueprint python-build-install-simplification
Signed-off-by: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
2018-09-03 11:10:16 +00:00
Jesse Pretorius f7de00cadd Optimise role execution
In order to optimise the role execution and
to improve consistency, the following is done:

1. The services dict is filtered per host to
   prevent skipped tasks from spamming the
   logs and wasting execution time.
2. The service restart is implemented in a
   specific order to improve consistency. The
   order implemented is a wild guess as there
   is no upstream documentation about the
   'correct' order.
3. The service enable/start is consolidated
   into the handler to be more efficient.
4. A dynamic include is used instead of nesting
   includes for the init prep.

Change-Id: I91d20b980f1b1a63ff2d6ef30bcec7ef58a5571a
2017-07-10 13:08:21 +01:00
Cuong Nguyen 43b276613f Use systemd module instead of shell
Using ansible systemd module to daemon reload and service reload is the solution for the future.

Change-Id: I5ff23e73b10c54648f90573f782033678f8d7a13
2017-01-24 11:04:39 +07:00
Andy McCrae b77c406c69 Remove Trusty support from os_heat role
Change-Id: If665515b30bfbd6b618c70357963df28d3d7de54
Implements: blueprint trusty-removal
2016-12-15 13:17:58 +00:00
Logan V 45d3856cf5 Fix linting issues for ansible-lint 3.4.1
Preparing this role for the ansible-lint version bump

Change-Id: I7f46254ee0270bcdeb49b1b059528fa862068a69
2016-11-02 12:20:24 +00:00
Jesse Pretorius 59e6ad589b Use dictionary for service group mappings
Change the 'heat_service_names' from a list to a dictionary mapping
of services, groups that install those services. This brings the
method into line with that used in the os_neutron role in order to
implement a more standardised method.

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.

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.

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.

Finally:
- 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.

Change-Id: I3624bd17995f00f63fe1243f4ea22db4b74832f4
2016-09-29 16:18:31 +01:00
Travis Truman 7085e74f97 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: I629928c12ef38380b95b12e93bc1d986edabcea7
2016-04-21 15:16:22 -04:00
Kevin Carter 275bfbad15 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