openstack-ansible-os_murano/tasks/murano_install.yml

99 lines
3.2 KiB
YAML

---
# 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: "murano"
option: "install_method"
value: "{{ murano_install_method }}"
mode: "0644"
- name: Refresh local facts to ensure the murano section is present
setup:
filter: ansible_local
gather_subset: "!all"
- name: Create the system group
group:
name: "{{ murano_system_group_name }}"
state: "present"
system: "yes"
- name: Create the murano system user
user:
name: "{{ murano_system_user_name }}"
group: "{{ murano_system_group_name }}"
comment: "{{ murano_system_comment }}"
shell: "{{ murano_system_shell }}"
system: "yes"
createhome: "yes"
home: "{{ murano_system_user_home }}"
- name: Create murano directories
file:
path: "{{ item.path | realpath }}"
state: directory
owner: "{{ item.owner | default(murano_system_user_name) }}"
group: "{{ item.group | default(murano_system_group_name) }}"
mode: "{{ item.mode | default(omit) }}"
with_items:
- path: "/openstack"
mode: "0755"
owner: "root"
group: "root"
- path: "/etc/murano"
mode: "0750"
- path: "{{ murano_system_user_home }}"
- name: Install distro packages
package:
name: "{{ murano_package_list }}"
state: "{{ murano_package_state }}"
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_facts['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: "{{ murano_git_constraints }}"
venv_build_distro_package_list: "{{ murano_distro_packages }}"
venv_install_destination_path: "{{ murano_bin | dirname }}"
venv_pip_install_args: "{{ murano_pip_install_args }}"
venv_pip_packages: >-
{{ murano_pip_packages |
union(murano_user_pip_packages) |
union(((murano_oslomsg_amqp1_enabled | bool) | ternary(murano_optional_oslomsg_amqp1_pip_packages, []))) }}
venv_facts_when_changed:
- section: "murano"
option: "venv_tag"
value: "{{ murano_venv_tag }}"
when: murano_install_method == 'source'
- name: Record the need for a service restart
ini_file:
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: "murano"
option: "need_service_restart"
value: true
mode: "0644"
when: (install_packages is changed) or
('need_service_restart' not in ansible_local['openstack_ansible']['murano'])