openstack-ansible-os_senlin/tasks/main.yml

212 lines
6.9 KiB
YAML

---
# Copyright 2020, Satish Patel <satish.lx@gmail.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: Fail if service was deployed using a different installation method
fail:
msg: "Switching installation methods for OpenStack services is not supported"
when:
- ansible_local is defined
- ansible_local.openstack_ansible is defined
- ansible_local.openstack_ansible.senlin is defined
- ansible_local.openstack_ansible.senlin.install_method is defined
- ansible_local.openstack_ansible.senlin.install_method != senlin_install_method
- 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
- name: Fail if our required secrets are not present
fail:
msg: "Please set the {{ item }} variable prior to applying this role."
when: (item is undefined) or (item is none)
with_items: "{{ senlin_required_secrets }}"
tags:
- always
- name: Gather variables for installation method
include_vars: "{{ senlin_install_method }}_install.yml"
tags:
- always
- name: Including osa.db_setup role
include_role:
name: openstack.osa.db_setup
apply:
tags:
- common-db
- senlin-config
when:
- _senlin_is_first_play_host
vars:
_oslodb_setup_host: "{{ senlin_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ senlin_db_setup_python_interpreter }}"
_oslodb_setup_endpoint: "{{ senlin_galera_address }}"
_oslodb_setup_port: "{{ senlin_galera_port }}"
_oslodb_databases:
- name: "{{ senlin_galera_database }}"
users:
- username: "{{ senlin_galera_user }}"
password: "{{ senlin_galera_password }}"
tags:
- always
- name: Including osa.mq_setup role
include_role:
name: openstack.osa.mq_setup
apply:
tags:
- common-mq
- senlin-config
when:
- _senlin_is_first_play_host
vars:
_oslomsg_rpc_setup_host: "{{ senlin_oslomsg_rpc_setup_host }}"
_oslomsg_rpc_userid: "{{ senlin_oslomsg_rpc_userid }}"
_oslomsg_rpc_password: "{{ senlin_oslomsg_rpc_password }}"
_oslomsg_rpc_vhost: "{{ senlin_oslomsg_rpc_vhost }}"
_oslomsg_rpc_transport: "{{ senlin_oslomsg_rpc_transport }}"
_oslomsg_notify_setup_host: "{{ senlin_oslomsg_notify_setup_host }}"
_oslomsg_notify_userid: "{{ senlin_oslomsg_notify_userid }}"
_oslomsg_notify_password: "{{ senlin_oslomsg_notify_password }}"
_oslomsg_notify_vhost: "{{ senlin_oslomsg_notify_vhost }}"
_oslomsg_notify_transport: "{{ senlin_oslomsg_notify_transport }}"
tags:
- always
- name: Importing senlin_pre_install tasks
import_tasks: senlin_pre_install.yml
tags:
- senlin-install
- name: Importing senlin_install tasks
import_tasks: senlin_install.yml
tags:
- senlin-install
- name: Create and install SSL certificates
include_role:
name: pki
tasks_from: main_certs.yml
apply:
tags:
- senlin-config
- pki
vars:
pki_setup_host: "{{ senlin_pki_setup_host }}"
pki_dir: "{{ senlin_pki_dir }}"
pki_create_certificates: "{{ senlin_user_ssl_cert is not defined and senlin_user_ssl_key is not defined }}"
pki_regen_cert: "{{ senlin_pki_regen_cert }}"
pki_certificates: "{{ senlin_pki_certificates }}"
pki_install_certificates: "{{ senlin_pki_install_certificates }}"
when:
- senlin_backend_ssl
tags:
- always
- name: Importing senlin_post_install tasks
import_tasks: senlin_post_install.yml
tags:
- senlin-config
- name: Run the systemd service role
import_role:
name: systemd_service
vars:
systemd_user_name: "{{ senlin_system_user_name }}"
systemd_group_name: "{{ senlin_system_group_name }}"
systemd_tempd_prefix: openstack
systemd_slice_name: senlin
systemd_lock_path: /var/lock/senlin
systemd_service_cpu_accounting: true
systemd_service_block_io_accounting: true
systemd_service_memory_accounting: true
systemd_service_tasks_accounting: true
systemd_services: "{{ filtered_senlin_services }}"
tags:
- senlin-config
- systemd-service
- name: Importing senlin_db_sync tasks
import_tasks: senlin_db_sync.yml
when:
- _senlin_is_first_play_host
tags:
- senlin-config
- name: Import uwsgi role
import_role:
name: uwsgi
vars:
uwsgi_services: "{{ senlin_uwsgi_services }}"
uwsgi_install_method: "{{ senlin_install_method }}"
tags:
- senlin-config
- uwsgi
- name: Including osa.service_setup role
include_role:
name: openstack.osa.service_setup
apply:
tags:
- common-service
- senlin-config
vars:
_project_name: "{{ senlin_project_name }}"
_project_domain: "{{ senlin_project_domain_name }}"
_service_adminuri_insecure: "{{ keystone_service_adminuri_insecure }}"
_service_in_ldap: "{{ senlin_service_in_ldap }}"
_service_setup_host: "{{ senlin_service_setup_host }}"
_service_setup_host_python_interpreter: "{{ senlin_service_setup_host_python_interpreter }}"
_service_project_name: "{{ senlin_service_project_name }}"
_service_region: "{{ senlin_service_region }}"
_service_users:
- name: "{{ senlin_service_user_name }}"
password: "{{ senlin_service_password }}"
domain: default
project: "{{ senlin_service_project_name }}"
role: "{{ senlin_service_role_names }}"
_service_endpoints:
- service: "{{ senlin_service_name }}"
interface: "public"
url: "{{ senlin_service_publicurl }}"
- service: "{{ senlin_service_name }}"
interface: "internal"
url: "{{ senlin_service_internalurl }}"
- service: "{{ senlin_service_name }}"
interface: "admin"
url: "{{ senlin_service_adminurl }}"
_service_catalog:
- name: "{{ senlin_service_name }}"
type: "{{ senlin_service_type }}"
description: "{{ senlin_service_description }}"
when:
- _senlin_is_first_play_host
tags:
- always
- name: Flush handlers
meta: flush_handlers