openstack-ansible-os_senlin/tasks/main.yml

168 lines
5.7 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: "{{ item }}"
with_first_found:
- "{{ 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"
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
- import_tasks: db_setup.yml
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:
- common-db
- senlin-config
- import_tasks: mq_setup.yml
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:
- common-mq
- senlin-config
- import_tasks: senlin_pre_install.yml
tags:
- senlin-install
- import_tasks: senlin_install.yml
tags:
- senlin-install
- 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_CPUAccounting: true
systemd_BlockIOAccounting: true
systemd_MemoryAccounting: true
systemd_TasksAccounting: true
systemd_services: "{{ filtered_senlin_services }}"
tags:
- senlin-config
- systemd-service
- 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
- include_tasks: service_setup.yml
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_name }}"
_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:
- senlin-config
- name: Flush handlers
meta: flush_handlers