--- # Copyright 2019, VEXXHOST, Inc. # # 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: Record the installation method ini_file: dest: "/etc/ansible/facts.d/openstack_ansible.fact" section: "mistral" option: "install_method" value: "{{ mistral_install_method }}" - name: Refresh local facts to ensure the mistral section is present setup: filter: ansible_local gather_subset: "!all" - name: create the system group group: name: "{{ mistral_system_group_name }}" state: "present" system: "yes" - name: Create the mistral system user user: name: "{{ mistral_system_user_name }}" group: "{{ mistral_system_group_name }}" comment: "{{ mistral_system_comment }}" shell: "{{ mistral_system_shell }}" system: "yes" createhome: "yes" home: "{{ mistral_system_user_home }}" - name: Create mistral directories file: path: "{{ item.path | realpath }}" state: directory owner: "{{ item.owner | default(mistral_system_user_name) }}" group: "{{ item.group | default(mistral_system_group_name) }}" mode: "{{ item.mode | default(omit) }}" with_items: - path: "/openstack" mode: "0755" owner: "root" group: "root" - path: "/etc/mistral" mode: "0750" - path: "{{ mistral_system_user_home }}" - path: "/var/log/mistral" mode: "0755" - name: Install distro packages package: name: "{{ mistral_package_list }}" state: "{{ mistral_package_state }}" update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}" cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}" register: install_packages until: install_packages is success retries: 5 delay: 2 - name: Install the python venv import_role: name: "python_venv_build" vars: venv_build_constraints: "{{ mistral_git_constraints }}" venv_build_distro_package_list: "{{ mistral_devel_distro_packages }}" venv_install_destination_path: "{{ mistral_bin | dirname }}" venv_pip_install_args: "{{ mistral_pip_install_args }}" venv_pip_packages: >- {{ mistral_pip_packages | union(mistral_user_pip_packages) | union(((mistral_oslomsg_amqp1_enabled | bool) | ternary(mistral_optional_oslomsg_amqp1_pip_packages, []))) }} venv_facts_when_changed: - section: "mistral" option: "venv_tag" value: "{{ mistral_venv_tag }}" when: mistral_install_method == 'source' - name: Record the need for a service restart ini_file: dest: "/etc/ansible/facts.d/openstack_ansible.fact" section: "mistral" option: "need_service_restart" value: true when: (install_packages is changed) or ('need_service_restart' not in ansible_local['openstack_ansible']['mistral']) - name: Ensure uWSGI directory exists file: path: "/etc/uwsgi/" state: directory mode: "0711" - name: Apply uWSGI configuration config_template: src: "mistral-uwsgi.ini.j2" dest: "/etc/uwsgi/{{ item.service_name }}.ini" mode: "0744" config_overrides: "{{ item.wsgi_overrides }}" config_type: ini with_items: "{{ filtered_mistral_services }}" when: item.wsgi_app | default(False) notify: - Manage LB - Restart mistral services