openstack-ansible-os_sahara/tasks/main.yml

155 lines
5.6 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_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
- "{{ ansible_os_family | lower }}.yml"
tags:
- always
- import_tasks: db_setup.yml
when:
- "sahara_services['sahara-api']['group'] in group_names"
- "inventory_hostname == ((groups[sahara_services['sahara-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
vars:
_oslodb_setup_host: "{{ sahara_db_setup_host }}"
_oslodb_databases:
- name: "{{ sahara_galera_database }}"
users:
- username: "{{ sahara_galera_user }}"
password: "{{ sahara_container_mysql_password }}"
tags:
- common-db
- sahara-config
- import_tasks: mq_setup.yml
when:
- "sahara_services['sahara-api']['group'] in group_names"
- "inventory_hostname == ((groups[sahara_services['sahara-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
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:
- common-mq
- sahara-config
- 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: inventory_hostname == groups['sahara_all'][0]
tags:
- sahara-config
- import_tasks: service_setup.yml
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_role_name }}"
_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: inventory_hostname == groups['sahara_all'][0]
tags:
- sahara-config
- name: Flush handlers
meta: flush_handlers