Commit Graph

32 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov eea1a4853f Fix linters and metadata
With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.

With that we also update metdata to reflect current state.

Depends-On: https://review.opendev.org/c/openstack/ansible-role-systemd_service/+/888223
Change-Id: Id92330b3c709201a74612c8353cefa75778eac0c
2023-07-14 20:44:53 +02:00
Dmitriy Rabotyagov e26aabe440 Remove mention of haproxy-endpoints role
Keystone 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: Ib21a5f5caa590daa827e45d26015bf32abe39cf2
2022-06-14 14:42:36 +02:00
Andrew Bonney 236f11c31d Fix ordering error enabling/disabling Apache modules
When site configuration already exists, a change to make a module
'absent' would fail as the module was removed before the
configuration.

This change ensures modules are enabled first, before site
configuration changes, and finally any required modules are
disabled.

Change-Id: I56a6c47e4d95e86dc1e0d731f1e39eeec6ac7dc8
2022-01-10 14:13:43 +00:00
Jonathan Rosser 0f2b8e16c9 Remove references to unsupported operating systems
All references to Gentoo, SUSE, Debian stretch and Centos-7  are removed.
Conditional tasks, ternary operators and variables are simplified where possible
OS specific variables files are generalised where possible

Change-Id: I1624730385a7b54cf36a94d313cc298430129736
2021-03-10 12:16:38 +00:00
Jonathan Rosser 489c169874 Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I8721b4fa97b41fb0c92f9eb99b61d31634e9aac6
2021-02-23 18:06:10 +00:00
Georgina 47fe909d54 Federated openid support using auth_mod_openidc
This patch adds support for using mod_auth_openidc instead of shibboleth for
supporting users who have a preference to use oidc for federation. A new
variable called apache_mod is added to keystone_sp allowing the auth library
to be selected. If left undefined shibboleth auth module will continue to be
installed by default maintaining backward compatibility.

This patch does not support simultaneous use of shibboleth and mod_auth_openidc
primarily because shib2 depends on libcurl3 but mod_auth_openidc depends on
libcurl4 which cannot coexist on Ubuntu. This can be resolved when there is a
shib3 package available in a future release of Ubuntu.

Change-Id: I80031f7d3f0fcc2029cd6861dcb6687e8a9f0a2e
2020-01-31 11:28:38 +00:00
Logan V 5e23c765b3 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: Ide9efbc79e4fd2c761a3ee4f463f501181da1df2
2017-09-16 13:41:28 -05:00
Major Hayden 31db740862
Add dnf support
This patch adds dnf support for CentOS.

Implements: blueprint centos-and-dnf
Change-Id: If5bfda4ee91e308e0a6d29ea13bd793d22132ba7
2017-08-02 13:36:25 -05:00
Markos Chandras 8c1ebb02a9 Add support for the openSUSE Leap distributions
Add support for the openSUSE Leap distributions. Additionally,
for openSUSE, we need to load some extra apache2 modules which are
not there by default.

Change-Id: Iac555cefa0a7a6ecf344761d54644fd3fa2443f9
2017-07-04 16:30:04 +01:00
Markos Chandras f375cac1f5 tasks: keystone_apache: Use the apache2_module Ansible module
The upstream bug https://github.com/ansible/ansible-modules-core/issues/5328
has been fixed so remove the workaround and use the Ansible module
directly.

Link: https://github.com/ansible/ansible-modules-core/issues/5328
Change-Id: Ibf50de533af3225654fe5215a83feab55494051e
2017-07-03 16:14:09 +01:00
Jesse Pretorius 84af640aa0 Switch to using Nginx/uWSGI by default
This patch implements the use of uWSGI exclusively,
always with a web server acting as a reverse proxy.
It removes the option of using uWSGI with Apache
and mod_wsgi.

In the case of Keystone being used in a Federated
Service Provider configuration, it will use Apache
as the web server but for all other environments
it will use Nginx instead.

Change-Id: If6e95fc0d3f7d34780db1aed2b8cedca87499934
2017-06-29 16:42:36 +00:00
Jesse Pretorius aad8144bfb Implement serialisable rolling upgrade
The current rolling upgrade implementation
relies on the role to orchestrate the rolling
upgrade. When the role is executed using
playbook serialisation, the db sync contract
is executed before all hosts are upgraded,
potentially resulting in data corruption.

This patch returns the role to the simpler,
best practice model of expecting that the role
is applied to a single host and that the
playbook handles orchestration. This method
can be used with any form of serialisation.

Depends-On: Ie90cdcbf9e73082a2074c8832b7490d188e178af
Change-Id: I5650f16b9a115bd392012b743788057a94d09226
2017-06-19 19:32:45 +00:00
Jean-Philippe Evrard 559e5a1b44 Remove {{ in when
Cleaning up the warnings like:

[WARNING]: when statements should not include jinja2 templating
delimiters such as {{ }} or {% %}. Found:
_apache2_module.stdout.find('{{ item.name }} already') == -1

Change-Id: I3180afb2f4a90179df1e3142eda906366ac4c9e8
2017-05-27 20:54:10 +00:00
Jesse Pretorius 94293c86c2 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: Ie913e5eb75f3601107b53bab7bda4a02ab1c1024
2017-04-04 10:49:52 +01:00
Jean-Philippe Evrard 15725b7128 Ensure the log folder exists
Restarting the apache service under ubuntu read the envvars file.
This envvars contains the folder for logrotate. If the folder
doesn't exist or hasn't the apache permissions, the restart of
the service will fail.

We ensure here the folder properly exists, with the right
permissions.

Change-Id: I4abf785f6d3d8ca4a5fc3c9520d046618cf6f380
2017-03-07 17:31:16 +00:00
Marc Gariepy 6c90338734 Do not listen on port 80
On centos by default apache listen on pour 80, commenting out thei
line in apache config

Change-Id: Id7e11a8eae48a92eb099f31729b22bede05fb193
2016-11-25 11:23:10 -05:00
Jimmy McCrory 04737f5dbd Implement zero downtime upgrades
This patch implements upgrading keystone with zero downtime as the
default installation process. Handlers have been modified to ensure that
the first keystone node is stopped, facilitates the database migrations,
and that it is started and available before restarting any other keystone
nodes. Migrations also now only occur when there is a change within the
installed keystone venv.

This process is documented at
http://docs.openstack.org/developer/keystone/upgrading.html#upgrading-without-downtime

A new test scenario has been added for testing basic upgradability
between releases.

Implements: blueprint upgrade-testing
Change-Id: I0d3cfcb80b64d005d60f4c8445f991855f844796
2016-11-17 08:10:57 -08:00
Jimmy McCrory 320e0e6e06 Workaround upstream issue with apache2_module
The apache2_module module in Ansible 2.2 is much more strict around
configuration syntax checks [0] [1].

Temporarily use the command module to enable/disable apache2 modules
until this issue is resolved. Also combine the enabling of apache2
modules into a single task and move it ahead of writing apache
configurations.

[0] https://github.com/ansible/ansible-modules-core/issues/5328
[1] https://github.com/ansible/ansible-modules-core/issues/5455

Change-Id: If59127a66a0349fde00912d64ff79762b0661859
2016-11-07 15:26:24 -08:00
Kevin Carter 6c902fc471 Remove 'ignore_errors: true' in favor of 'failed_when: false'
This change removes the use of 'ignore_errors: true' because it causes deployers
to see red output and a stacktrace, which traditionally means something is broken,
even when the failure is known to have a fall back option or be intentional. This
conversion will provide a generally cleaner interface.

It should be noted that the 'failed' filter will still function normally. Tasks
with the 'failed_when: false' option will still be marked as 'failed' in any
registered variable. This change simply makes the output look cleaner.

Change-Id: I5ceece61312e2bf39d7489261bca247f353d6d74
Closes-Bug: #1633438
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-10-14 16:45:41 -05:00
Marc Gariepy 60dac156cb Enable apache2 service.
On CentOS, service are not enabled by default. A restart of the
container will not start keystone.

Change-Id: Ib00fdf2d652316f80c33be19dd3ee39831b1c491
2016-10-04 09:39:18 -04:00
Andy McCrae 38dbd423d6 Fix apache + uwsgi for keystone
The vars port specification in the keystone-httpd.conf.j2 were
incorrectly referencing vars instead of strings, causing failures.

Additionally, the conf created for uwsgi and apache includes all the
WSGI settings - which is not in line with how it should look.

Encasing the WSGI settings in an if statement so that it lines up with
the example conf file from the keystone docs.

We will also need to enable the proxy_http module for uwsgi with apache.

Change-Id: I64eec88452333eee6397ccbad13cd80a5275e607
2016-09-01 14:36:03 +01:00
Kevin Carter 0de819e92a Implement CentOS 7 support in os_keystone
This change implements CentOS 7 support within the os_keystone role.

Depends-on: I333fb1887339e8dc9ebf10ff137dda3cff629dc0
Change-Id: Ib339cd0657f7008fa48bf74f8d6ddd4b8add2ea1
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-08-29 14:20:48 +00:00
Travis Truman d208029342 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: I0e14d913a069fa25b90cfd8daf922ae093056203
2016-07-11 08:57:41 -04:00
Travis Truman 8797fc707a Cleanup/standardize usage of tags
The numerous tags within the role have been condensed
to two tags: keystone-install and keystone-config

These tags have been chosen as they are namespaced
and cover the two major functions of the role.

Documentation has been updated to inform how each tag
influences the function of the role.

Change-Id: Iea4bff944ce0a35a4b1bc044171472ea44eda323
2016-05-24 15:51:03 -04:00
Bjoern Teipel 7704d94c74 Add support to tune the keystone apache MPM settings
This fix adds support to tune the apache MPM server settings
in case more HTTP threads are needed.

New overrides have been predefined in order to use the Ubuntu
default settings:

     keystone_httpd_mpm_backend: event
     keystone_httpd_mpm_start_servers: 2
     keystone_httpd_mpm_min_spare_threads: 25
     keystone_httpd_mpm_max_spare_threads: 75
     keystone_httpd_mpm_thread_limit: 64
     keystone_httpd_mpm_thread_child: 25
     keystone_httpd_mpm_max_requests: 150
     keystone_httpd_mpm_max_conn_child: 0

Change-Id: Ieaad4d2b3c62a5b59e1fa597816ab1b4c2fc3cb1
Closes-Bug: #1576399
2016-05-04 11:50:06 -04:00
Kevin Carter dfd80ea8f8
Fix server/hostname for RFC 1034/1035
This change ensures that the apache ServerName is being set to
the **ansible_hostname** fact. This ensures the Apache web server
has an appropriate server name which is compliant to the RFC.

Change-Id: Ia48dcf07d903b63cd7e5afaa2598d24dbdcb9642
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-04-17 01:09:04 -05:00
Travis Truman c35ba5fbce Removing unneeded with_items usage for clarity
Change-Id: Ia893b793b308da076124f7b97d1e558feaa39277
2016-03-06 16:31:19 -05:00
Jean-Philippe Evrard 62cb64eff4 Apache servers will not reporting version anymore
In order to make it more difficult to know which
httpd server is running, here is a change to 
reduce the ServerTokens OS to ServerTokens Prod
and the ServerSignature On to ServerSignature Off.

This removes ServerName and version report
on page footer and reduces the detail of the httpd
server running in the headers to "Apache". 

These options can be overwritten by an user variable

Change-Id: I1aaffaa3b6b7d6574aefac65b6027e62240a702b
Closes-Bug: #1484256
2015-08-19 13:59:02 +00:00
Jesse Pretorius bfb378f19b Keystone SSL cert/key distribution and configuration
This patch adds the option to provide an SSL certificate for the
Keystone service (either self-signed or user provided) and to
configure the endpoints and Keystone service appropriately.

* A new boolean variable called 'keystone_ssl' enables/disables
  the configuration of SSL for the Keystone service.

* The server key/certificate (and optionally a CA cert) are
  distributed to all keystone containers and used for the setup
  of SSL endpoints if the appropriate protocol is set.

* The internal/public and the admin endpoints can be set to be
  served via http or https seperately via the
  'keystone_service_*_proto' variables.

* The logic to determine the appropriate load balancing
  configuration based on the Keystone endpoint protocol has
  been implemented in the haproxy vars.

* Two new variables have been implemented for a user-provided
  server key and certificate:
  - keystone_user_ssl_cert: <path to cert on deployment host>
  - keystone_user_ssl_key: <path to cert on deployment host>
  If either of these is not defined, but a Keystone endpoint
  has been configured for SSL, then the missing cert/key
  will be self generated on the first Keystone container and
  distributed to the other containers.

* A new variable has been implemented for a user-provided CA
  certificate:
  - keystone_user_ssl_ca_cert: <path to cert on deployment host>

* A new variable called 'keystone_ssl_self_signed_subject' has
  been implemented to allow the user to override the certificate
  properties, such as the CN and subjectAltName.

Upgrade notes:

* The SSL-based client authentication configuration in Apache
  has been removed as it appears to be unused.

* The minimum Ansible version for the os_keystone and
  haproxy_server roles have been increased to v1.9.0 as it's
  the minimum version that supports ternary filters.

* The boolean 'keystone_ssl_enabled' has been renamed to
  'keystone_ssl'. This maintains a pattern set in the haproxy
  role for enablement of ssl offloading in the load balancer.

* The Apache configuration appropriately implements the
  'SSLCACertificateFile' instead of the 'SSLCACertificatePath'
  directive in order to ensure that the appropriate signing
  certificate is provided to the browser.

* The 'keystone_self_signed_regen' variable has been renamed
  to 'keystone_ssl_self_signed_regen'.

* The default names for the deployed keys/certificates have been
  changed:
  - /etc/ssl/certs/apache.cert  > /etc/ssl/certs/keystone.pem
  - /etc/ssl/private/apache.key > /etc/ssl/private/keystone.key

DocImpact
Partial-Bug: #1466827
Implements: blueprint keystone-federation
Change-Id: I4c5ea7b6bfc3d7d7230a7440fa501241826c9dee
Co-Authored-By: Miguel Grinberg <miguelgrinberg50@gmail.com>
2015-08-19 07:51:09 +00:00
Miguel Grinberg 17ac571e7a Keystone Federation Service Provider Configuration
This patch adds the ability to configure Keystone as a Service
Provider (SP) for a Federated Identity Provider (IdP).

* New variables to configure Keystone as a service provider are now
  supported under a root `keystone_sp` variable. Example configurations
  can be seen in Keystone's defaults file. This configuration includes
  the list of identity providers and trusted dashboards. (At this time
  only one identity provider is supported).

* Identity provider configuration includes the remote-to-local user
  mapping and the list of remote attributes the SP can obtain from the
  IdP.

* Shibboleth is installed and configured in the Keystone containers when
  SP configuration is present.

* Horizon is configured for SSO login

DocImpact
UpgradeImpact
Implements: blueprint keystone-federation
Change-Id: I78b3d740434ea4b3ca0bd9f144e4a07026be23c6
Co-Authored-By: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
2015-08-07 08:44:51 +00:00
git-harry 7a8873415c Fix errors when enabling SSL for apache
keystone_ssl_enabled is used to determine whether or not to configure
apache to use SSL. Currently when this variable is set to true the
apache SSL module is not enabled.

This commit adds a task to enable/disable the SSL module based on the
variable keystone_ssl_enabled.

The keystone-httpd.conf template causes a formatting error. This commit
fixes the error so that additional whitespace is no longer added before
SSLEngine.

Change-Id: I1415e5822684af12e1a1dd8a306e708e8931fa38
Closes-bug: #1466827
2015-06-24 13:33:12 +01:00
Kevin Carter 9f68cf8781 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