openstack-ansible-os_sahara/tasks/main.yml

169 lines
5.8 KiB
YAML

---
# 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: "{{ 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 }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"
tags:
- always
- include_role:
name: openstack.osa.db_setup
apply:
tags:
- common-db
- sahara-config
when:
- _sahara_is_first_play_host
vars:
_oslodb_setup_host: "{{ sahara_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ sahara_db_setup_python_interpreter }}"
_oslodb_setup_endpoint: "{{ sahara_galera_address }}"
_oslodb_setup_port: "{{ sahara_galera_port }}"
_oslodb_databases:
- name: "{{ sahara_galera_database }}"
users:
- username: "{{ sahara_galera_user }}"
password: "{{ sahara_container_mysql_password }}"
tags:
- always
- include_role:
name: openstack.osa.mq_setup
apply:
tags:
- common-mq
- sahara-config
when:
- _sahara_is_first_play_host
vars:
_oslomsg_rpc_setup_host: "{{ sahara_oslomsg_rpc_setup_host }}"
_oslomsg_rpc_userid: "{{ sahara_oslomsg_rpc_userid }}"
_oslomsg_rpc_password: "{{ sahara_oslomsg_rpc_password }}"
_oslomsg_rpc_vhost: "{{ sahara_oslomsg_rpc_vhost }}"
_oslomsg_rpc_transport: "{{ sahara_oslomsg_rpc_transport }}"
_oslomsg_notify_setup_host: "{{ sahara_oslomsg_notify_setup_host }}"
_oslomsg_notify_userid: "{{ sahara_oslomsg_notify_userid }}"
_oslomsg_notify_password: "{{ sahara_oslomsg_notify_password }}"
_oslomsg_notify_vhost: "{{ sahara_oslomsg_notify_vhost }}"
_oslomsg_notify_transport: "{{ sahara_oslomsg_notify_transport }}"
tags:
- always
- import_tasks: sahara_pre_install.yml
tags:
- sahara-install
- name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_python_executable: "{{ sahara_venv_python_executable }}"
venv_build_constraints: "{{ sahara_git_constraints }}"
venv_install_destination_path: "{{ sahara_bin | dirname }}"
venv_install_distro_package_list: "{{ sahara_distro_packages }}"
venv_pip_install_args: "{{ sahara_pip_install_args }}"
venv_pip_packages: >-
{{ sahara_pip_packages |
union(sahara_user_pip_packages) |
union(sahara_plugin_pip_packages) |
union(((sahara_oslomsg_amqp1_enabled | bool) | ternary(sahara_optional_oslomsg_amqp1_pip_packages, []))) }}
venv_facts_when_changed:
- section: "sahara"
option: "venv_tag"
value: "{{ sahara_venv_tag }}"
tags:
- sahara-install
- import_tasks: sahara_post_install.yml
tags:
- sahara-config
- name: Import uwsgi role
import_role:
name: uwsgi
vars:
uwsgi_services: "{{ uwsgi_sahara_services }}"
uwsgi_install_method: "source"
tags:
- sahara-config
- uwsgi
- name: Run the systemd service role
import_role:
name: systemd_service
vars:
systemd_user_name: "{{ sahara_system_user_name }}"
systemd_group_name: "{{ sahara_system_group_name }}"
systemd_tempd_prefix: openstack
systemd_slice_name: sahara
systemd_lock_path: /var/lock/sahara
systemd_CPUAccounting: true
systemd_BlockIOAccounting: true
systemd_MemoryAccounting: true
systemd_TasksAccounting: true
systemd_services: "{{ filtered_sahara_services }}"
tags:
- sahara-config
- systemd-service
- import_tasks: sahara_db_sync.yml
when: _sahara_is_first_play_host
tags:
- sahara-config
- include_role:
name: openstack.osa.service_setup
apply:
tags:
- common-service
- sahara-config
vars:
_service_adminuri_insecure: "{{ keystone_service_adminuri_insecure }}"
_service_in_ldap: "{{ sahara_service_in_ldap }}"
_service_setup_host: "{{ sahara_service_setup_host }}"
_service_setup_host_python_interpreter: "{{ sahara_service_setup_host_python_interpreter }}"
_service_project_name: "{{ sahara_service_project_name }}"
_service_region: "{{ sahara_service_region }}"
_domain_name: "{{ sahara_proxy_user_domain_name }}"
_service_users:
- name: "{{ sahara_service_user_name }}"
password: "{{ sahara_service_password }}"
role: "{{ sahara_service_role_names }}"
_service_endpoints:
- service: "{{ sahara_service_name }}"
interface: "public"
url: "{{ sahara_service_publicuri }}"
- service: "{{ sahara_service_name }}"
interface: "internal"
url: "{{ sahara_service_internaluri }}"
- service: "{{ sahara_service_name }}"
interface: "admin"
url: "{{ sahara_service_adminuri }}"
_service_catalog:
- name: "{{ sahara_service_name }}"
type: "{{ sahara_service_type }}"
description: "{{ sahara_service_description }}"
when: _sahara_is_first_play_host
tags:
- always
- name: Flush handlers
meta: flush_handlers