Damian Dabrowski ea456d9c21 Add TLS support to adjutant backends
By overriding the variable `adjutant_backend_ssl: True` HTTPS will
be enabled, disabling HTTP support on the adjutant 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: I97c8f8b16d689782ab0079667847de22821f6027
2023-04-29 18:35:20 +02:00

167 lines
5.4 KiB
YAML

---
# Copyright 2016, Rackspace US, Inc.
#
# (C) 2016 Michael Rice <michael.rice@rackspace.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather variables for each operating system
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"
paths:
- "{{ role_path }}/vars"
tags:
- always
- include_role:
name: openstack.osa.db_setup
apply:
tags:
- common-db
- adjutant-config
when: _adjutant_is_first_play_host
vars:
_oslodb_setup_host: "{{ adjutant_galera_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ adjutant_galera_setup_python_interpreter }}"
_oslodb_setup_endpoint: "{{ adjutant_galera_address }}"
_oslodb_setup_port: "{{ adjutant_galera_port }}"
_oslodb_databases:
- name: "{{ adjutant_galera_database }}"
users:
- username: "{{ adjutant_galera_user }}"
password: "{{ adjutant_galera_password }}"
tags:
- always
- import_tasks: adjutant_pre_install.yml
tags:
- adjutant-install
- import_tasks: adjutant_install.yml
tags:
- adjutant-install
- name: Create and install SSL certificates
include_role:
name: pki
tasks_from: main_certs.yml
apply:
tags:
- adjutant-config
- pki
vars:
pki_setup_host: "{{ adjutant_pki_setup_host }}"
pki_dir: "{{ adjutant_pki_dir }}"
pki_create_certificates: "{{ adjutant_user_ssl_cert is not defined and adjutant_user_ssl_key is not defined }}"
pki_regen_cert: "{{ adjutant_pki_regen_cert }}"
pki_certificates: "{{ adjutant_pki_certificates }}"
pki_install_certificates: "{{ adjutant_pki_install_certificates }}"
when:
- adjutant_backend_ssl
tags:
- always
- import_tasks: adjutant_post_install.yml
tags:
- adjutant-config
- import_tasks: adjutant_db_sync.yml
when: _adjutant_is_first_play_host
tags:
- adjutant-config
- include_role:
name: openstack.osa.service_setup
apply:
tags:
- common-service
- adjutant-config
vars:
_service_adminuri_insecure: "{{ keystone_service_adminuri_insecure }}"
_service_in_ldap: "{{ adjutant_service_in_ldap }}"
_service_setup_host: "{{ adjutant_service_setup_host }}"
_service_setup_host_python_interpreter: "{{ adjutant_service_setup_host_python_interpreter }}"
_service_project_name: "{{ adjutant_service_project_name }}"
_service_region: "{{ adjutant_service_region }}"
_service_users:
- name: "{{ adjutant_service_user_name }}"
password: "{{ adjutant_service_password }}"
role: "{{ adjutant_role_name }}"
- role: "project_mod"
- role: "project_admin"
_service_catalog:
- name: "{{ adjutant_service_name }}"
type: "{{ adjutant_service_type }}"
description: "{{ adjutant_service_description }}"
_service_endpoints:
- interface: "public"
url: "{{ adjutant_service_publicurl }}"
service: "{{ adjutant_service_name }}"
- interface: "internal"
url: "{{ adjutant_service_internalurl }}"
service: "{{ adjutant_service_name }}"
- interface: "admin"
url: "{{ adjutant_service_adminurl }}"
service: "{{ adjutant_service_name }}"
when: _adjutant_is_first_play_host
tags:
- always
- name: Run the systemd service role
include_role:
name: systemd_service
vars:
systemd_user_name: "{{ adjutant_system_user_name }}"
systemd_group_name: "{{ adjutant_system_group_name }}"
systemd_tempd_prefix: openstack
systemd_slice_name: adjutant
systemd_lock_path: /var/lock/adjutant
systemd_CPUAccounting: true
systemd_BlockIOAccounting: true
systemd_MemoryAccounting: true
systemd_TasksAccounting: true
systemd_services:
- service_name: "{{ service_var.service_name }}"
enabled: "{{ service_var.enabled | default(True) }}"
state: "{{ service_var.state | default('started') }}"
execstarts: "{{ service_var.execstarts }}"
execreloads: "{{ service_var.execreloads | default([]) }}"
config_overrides: "{{ service_var.init_config_overrides }}"
with_items: "{{ filtered_adjutant_services }}"
loop_control:
loop_var: service_var
tags:
- adjutant-config
- systemd-service
- name: Import uwsgi role
import_role:
name: uwsgi
vars:
uwsgi_services: "{{ uwsgi_adjutant_services }}"
uwsgi_install_method: "source"
tags:
- adjutant-install
- adjutant-config
- uwsgi
- name: Flush handlers
meta: flush_handlers