Use infrastructure playbooks from openstack-ansible-plugins repo

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-plugins/+/924171
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/924168
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-plugins/+/927826
Change-Id: I4159671a9964f23626ee8c7ea6153c12597cacab
This commit is contained in:
Jonathan Rosser 2024-07-16 17:38:09 +01:00
parent 50f16d1e13
commit ff7b294b90
11 changed files with 36 additions and 976 deletions

View File

@ -13,304 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather ceph-mon facts
hosts: ceph-mon
gather_facts: false
tasks:
- name: Refresh all_addresses facts
setup:
gather_subset: "all_ipv4_addresses,all_ipv6_addresses"
tags:
- always
- name: Install ceph mons
hosts: ceph-mon
user: root
gather_facts: false
pre_tasks:
- name: Setup installation variables
include_role:
name: openstack.osa.install_defaults
defaults_from: "{{ install_method }}"
public: true
apply:
tags:
- always
tags:
- always
- name: Gather additional facts for monitor_address_block
include_role:
name: openstack.osa.gather_extra_facts
vars:
deployment_extra_facts_filter: "ansible_all_ipv[4|6]_addresses"
deployment_extra_facts_subset: "!all,network"
when: monitor_address_block is defined
args:
apply:
tags:
- always
tags:
- always
- name: Gather additional facts for monitor_interface
include_role:
name: openstack.osa.gather_extra_facts
vars:
deployment_extra_facts_filter: "{{ 'ansible_' ~ monitor_interface | replace('-','_') }}"
deployment_extra_facts_subset: "!all,network"
when: monitor_interface is defined
args:
apply:
tags:
- always
tags:
- always
- name: Gather memory facts
include_role:
name: openstack.osa.gather_extra_facts
vars:
deployment_extra_facts_filter: "ansible_memtotal*"
deployment_extra_facts_subset: "!all,hardware"
args:
apply:
tags:
- always
tags:
- always
- name: Including container setup role
include_role:
name: "openstack.osa.{{ container_tech | default('lxc') }}_container_setup"
when: not is_metal
vars:
list_of_bind_mounts: "{{ ceph_container_bind_mounts }}"
- name: Including unbound-clients role
include_role:
name: openstack.osa.unbound_clients
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
# Set the priority of the ceph community apt repo either above or below that of UCA or distro sources
- name: Set apt package pins
include_role:
name: apt_package_pinning
vars:
apt_package_pinning_file_name: "ceph_community_pin.pref"
apt_package_pinning_priority: "{{ (ceph_repository == 'community') | ternary(1000, 100) }}"
apt_pinned_packages: [{ package: '*', release: 'ceph.com' }]
when:
- ansible_facts['pkg_mgr'] == 'apt'
- name: Install python3-yaml
package:
name: "{{ (ansible_facts['os_family'] | lower == 'debian') | ternary('python3-yaml', 'python3-pyyaml') }}"
state: present
- name: Create systemd service directory
file:
path: "/etc/systemd/system/ceph-mon@.service.d/"
state: directory
group: "root"
owner: "root"
mode: "0755"
when:
- ansible_facts['pkg_mgr'] == 'dnf'
- ansible_facts['service_mgr'] == 'systemd'
- name: Add systemd override for PrivateDevices
copy:
dest: "/etc/systemd/system/ceph-mon@.service.d/ceph-mon-systemd-overrides.conf"
content: |
[Service]
PrivateDevices=false
mode: "0640"
when:
- ansible_facts['pkg_mgr'] == 'dnf'
- ansible_facts['service_mgr'] == 'systemd'
roles:
- role: ceph-defaults
tags:
- skip_ansible_lint
- role: ceph-facts
tags:
- skip_ansible_lint
- role: ceph-common
tags:
- skip_ansible_lint
- role: ceph-handler
tags:
- skip_ansible_lint
- role: ceph-config
tags:
- skip_ansible_lint
- role: ceph-mon
tags:
- skip_ansible_lint
- role: ceph-mgr
tags:
- skip_ansible_lint
- role: openstack.osa.system_crontab_coordination
tags:
- crontab
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- ceph
- ceph-mon
- name: Gather ceph-osd facts
hosts: ceph-osd
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always
- name: Install ceph osds
hosts: ceph-osd
user: root
gather_facts: false
pre_tasks:
- name: Setup installation variables
include_role:
name: openstack.osa.install_defaults
defaults_from: "{{ install_method }}"
public: true
apply:
tags:
- always
tags:
- always
- name: Gather memory facts
include_role:
name: openstack.osa.gather_extra_facts
vars:
deployment_extra_facts_filter: "ansible_memtotal*"
deployment_extra_facts_subset: "!all,hardware"
args:
apply:
tags:
- always
tags:
- always
- name: Including container setup role
include_role:
name: "openstack.osa.{{ container_tech | default('lxc') }}_container_setup"
when: not is_metal
vars:
list_of_bind_mounts: "{{ ceph_container_bind_mounts }}"
- name: Including unbound-clients tasks
include_role:
name: openstack.osa.unbound_clients
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
# Set the priority of the ceph community apt repo either above or below that of UCA or distro sources
- name: Set apt package pins
include_role:
name: apt_package_pinning
vars:
apt_package_pinning_file_name: "ceph_community_pin.pref"
apt_package_pinning_priority: "{{ (ceph_repository == 'community') | ternary(1000, 100) }}"
apt_pinned_packages: [{ package: '*', release: 'ceph.com' }]
when:
- ansible_facts['pkg_mgr'] == 'apt'
- name: Install python3-yaml
package:
name: "{{ (ansible_facts['os_family'] | lower == 'debian') | ternary('python3-yaml', 'python3-pyyaml') }}"
state: present
roles:
- role: ceph-defaults
tags:
- skip_ansible_lint
- role: ceph-facts
tags:
- skip_ansible_lint
- role: ceph-common
tags:
- skip_ansible_lint
- role: ceph-handler
tags:
- skip_ansible_lint
- role: ceph-config
tags:
- skip_ansible_lint
- role: ceph-osd
tags:
- skip_ansible_lint
- role: openstack.osa.system_crontab_coordination
tags:
- crontab
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- ceph
- ceph-osd
- name: Gather ceph-mds facts
hosts: ceph-mds
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always
- name: Install ceph metadata servers
hosts: ceph-mds
gather_facts: false
user: root
pre_tasks:
- name: Setup installation variables
include_role:
name: openstack.osa.install_defaults
defaults_from: "{{ install_method }}"
public: true
apply:
tags:
- always
tags:
- always
- name: Gather memory facts
include_role:
name: openstack.osa.gather_extra_facts
vars:
deployment_extra_facts_filter: "ansible_memtotal*"
deployment_extra_facts_subset: "!all,hardware"
args:
apply:
tags:
- always
tags:
- always
roles:
- role: ceph-defaults
tags:
- skip_ansible_lint
- role: ceph-facts
tags:
- skip_ansible_lint
- role: ceph-common
tags:
- skip_ansible_lint
- role: ceph-handler
tags:
- skip_ansible_lint
- role: ceph-config
tags:
- skip_ansible_lint
- role: ceph-mds
tags:
- skip_ansible_lint
- role: "openstack.osa.system_crontab_coordination"
tags:
- "system-crontab-coordination"
vars:
is_metal: "{{ properties.is_metal|default(false) }}"
tags:
- ceph-mds
- name: Importing ceph_install playbook
import_playbook: openstack.osa.ceph_install

View File

@ -13,63 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather ceph-nfs facts
hosts: ceph-nfs
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always
- name: Install nfs-ganesha server
hosts: ceph-nfs
gather_facts: false
user: root
pre_tasks:
- name: Setup installation variables
include_role:
name: openstack.osa.install_defaults
defaults_from: "{{ install_method }}"
public: true
apply:
tags:
- always
tags:
- always
- name: Gather ceph-mon facts
action: setup
delegate_to: "{{ item }}"
delegate_facts: yes
with_items: "{{ groups[mon_group_name] }}"
when:
- inventory_hostname == ansible_play_hosts[0]
tags:
- ceph-mon-facts
- ceph-nfs
# NOTE(noonedeadpunk) drop this once https://github.com/ceph/ceph-ansible/pull/4959 will be merged
- name: Create ganesha log dir
file:
path: /var/log/ganesha
owner: root
group: root
mode: "0755"
state: directory
roles:
- role: ceph-defaults
tags:
- skip_ansible_lint
- role: ceph-facts
tags:
- skip_ansible_lint
- role: ceph-common
tags:
- skip_ansible_lint
- role: ceph-handler
tags:
- skip_ansible_lint
- role: ceph-nfs
tags:
- skip_ansible_lint
vars:
is_metal: "{{ properties.is_metal|default(false) }}"
tags:
- ceph-nfs
- name: Importing ceph_nfs_install playbook
import_playbook: openstack.osa.ceph_nfs_install

View File

@ -1,61 +1,17 @@
- name: Create ceph pools
hosts: "{{ groups['ceph-mon'][0] | default([]) }}"
user: root
gather_facts: false
vars:
is_metal: "{{ properties.is_metal|default(false) }}"
vars_files:
- "defaults/{{ install_method }}_install.yml"
roles:
- role: ceph-defaults
tags:
- skip_ansible_lint
tasks:
- name: Create openstack pool(s)
ceph_pool:
name: "{{ item.name }}"
cluster: "{{ cluster }}"
pg_num: "{{ item.pg_num | default(omit) }}"
pgp_num: "{{ item.pgp_num | default(omit) }}"
size: "{{ item.size | default(omit) }}"
min_size: "{{ item.min_size | default(omit) }}"
pool_type: "{{ item.type | default('replicated') }}"
rule_name: "{{ item.rule_name | default(omit) }}"
erasure_profile: "{{ item.erasure_profile | default(omit) }}"
pg_autoscale_mode: "{{ item.pg_autoscale_mode | default(omit) }}"
target_size_ratio: "{{ item.target_size_ratio | default(omit) }}"
application: "{{ item.application | default(omit) }}"
with_items: "{{ openstack_pools }}"
---
# Copyright 2024 BBC R&D
#
# 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: Generate keys
ceph_key:
name: "{{ item.name }}"
caps: "{{ item.caps }}"
secret: "{{ item.key | default('') }}"
cluster: "{{ cluster }}"
mode: "{{ item.mode | default(ceph_keyring_permissions) }}"
with_items: "{{ openstack_keys }}"
no_log: "{{ no_log_on_ceph_key_tasks }}"
- name: Get keys from monitors
ceph_key:
name: "{{ item.name }}"
cluster: "{{ cluster }}"
output_format: plain
state: info
register: _osp_keys
with_items: "{{ openstack_keys }}"
no_log: "{{ no_log_on_ceph_key_tasks }}"
- name: Distribute ceph keys to all mons
ansible.builtin.copy:
dest: "/etc/ceph/{{ cluster }}.{{ item.0.item.name }}.keyring"
content: "{{ item.0.stdout + '\n' }}"
owner: 'ceph'
group: 'ceph'
mode: "{{ item.0.item.mode | default(ceph_keyring_permissions) }}"
with_nested:
- "{{ _osp_keys.results }}"
- "{{ groups['ceph-mon'] }}"
delegate_to: "{{ item.1 }}"
no_log: "{{ no_log_on_ceph_key_tasks }}"
- name: Importing ceph_pools playbook
import_playbook: openstack.osa.ceph_pools

View File

@ -13,81 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather galera facts
hosts: galera_all
gather_facts: "{{ osa_gather_facts | default(True) }}"
tasks:
- name: Gather additional facts
include_role:
name: openstack.osa.gather_extra_facts
when: osa_gather_facts | default(True)
tags:
- always
- name: Configure haproxy services
import_playbook: openstack.osa.haproxy_service_config
vars:
service_group: galera_all
service_variable: "galera_haproxy_services"
when:
- groups[service_group] | length > 0
- groups['haproxy'] | length > 0
tags:
- haproxy-service-config
- name: Install galera server
hosts: galera_all
gather_facts: false
serial: "{{ galera_serial | default(1) }}"
user: root
pre_tasks:
- name: Including container-setup tasks
include_role:
name: "openstack.osa.{{ container_tech | default('lxc') }}_container_setup"
when: not is_metal
vars:
list_of_bind_mounts: "{{ galera_container_bind_mounts }}"
extra_container_config_no_restart:
- "lxc.start.order=10"
- name: Including unbound-clients tasks
include_role:
name: openstack.osa.unbound_clients
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- name: Disabling haproxy backends
include_role:
name: openstack.osa.haproxy_endpoint_manage
apply:
tags:
- always
vars:
haproxy_backend: galera-back
haproxy_state: drain
when:
- "groups['galera_all'] | length > 1"
roles:
- role: "galera_server"
vars:
galera_install_client: "{{ (galera_root_user == 'root') }}"
galera_install_server: true
- role: "openstack.osa.system_crontab_coordination"
tags:
- crontab
post_tasks:
- name: Enabling haproxy backends
include_role:
name: openstack.osa.haproxy_endpoint_manage
apply:
tags:
- always
vars:
haproxy_backend: galera-back
haproxy_state: enabled
when:
- "groups['galera_all'] | length > 1"
vars:
galera_server_id: "{{ inventory_hostname | openstack.osa.string_2_int }}"
galera_wsrep_node_name: "{{ container_name | default(inventory_hostname) }}"
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- galera
- name: Importing mariadb/galera playbook
import_playbook: openstack.osa.galera_server

View File

@ -13,32 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather memcached facts
hosts: memcached
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always
- name: Install memcached
hosts: memcached
gather_facts: false
serial: "{{ memcached_serial | default(['1','100%']) }}"
user: root
pre_tasks:
- name: Including container-setup tasks
include_role:
name: "openstack.osa.{{ container_tech | default('lxc') }}_container_setup"
when: not is_metal
- name: Including unbound-clients tasks
include_role:
name: openstack.osa.unbound_clients
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
roles:
- role: "memcached_server"
- role: "openstack.osa.system_crontab_coordination"
tags:
- crontab
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- memcached
- name: Importing memcached playbook
import_playbook: openstack.osa.memcached

View File

@ -13,99 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather etcd facts
hosts: "{{ rabbitmq_host_group | default('rabbitmq_all') }}"
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always
- name: Create and configure rabbitmq container
hosts: "{{ rabbitmq_host_group | default('rabbitmq_all') }}"
serial: "{{ rabbitmq_serial | default('20%') }}"
gather_facts: false
user: root
pre_tasks:
- name: Including container-setup tasks
include_role:
name: "openstack.osa.{{ container_tech | default('lxc') }}_container_setup"
vars:
extra_container_config_no_restart:
- "lxc.start.order=19"
when: not is_metal
- name: Including unbound-clients tasks
include_role:
name: openstack.osa.unbound_clients
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
roles:
- role: "openstack.osa.system_crontab_coordination"
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- rabbitmq
# Stable feature flags must be enabled pre-upgrade
# https://www.rabbitmq.com/docs/feature-flags#version-compatibility
- name: Enable stable feature flags pre-upgrade
hosts: "{{ rabbitmq_host_group | default('rabbitmq_all') }}[0]"
gather_facts: false
user: root
tasks:
- name: Running feature flags tasks from the role
import_role:
name: rabbitmq_server
tasks_from: rabbitmq_feature_flags.yml
when: rabbitmq_upgrade | default(false) | bool
# The cluster must be stopped when doing major/minor upgrades
# http://www.rabbitmq.com/clustering.html#upgrading
- name: Stop RabbitMQ nodes that are not the upgrader
hosts: "{{ rabbitmq_host_group | default('rabbitmq_all') }}[1:]"
gather_facts: false
user: root
tasks:
- name: "Stop RabbitMQ"
service:
name: "rabbitmq-server"
state: "stopped"
when: rabbitmq_upgrade | default(false) | bool
- name: Configure haproxy services
import_playbook: openstack.osa.haproxy_service_config
vars:
service_group: rabbitmq_all
service_variable: "rabbitmq_haproxy_services"
when:
- groups[service_group] | length > 0
- groups['haproxy'] | length > 0
tags:
- haproxy-service-config
- name: Install rabbitmq server
hosts: "{{ rabbitmq_host_group | default('rabbitmq_all') }}"
gather_facts: false
serial: "{{ rabbitmq_serial | default('20%') }}"
user: root
roles:
- role: "rabbitmq_server"
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- rabbitmq
- name: Ensure rabbitmq user for monitoring GUI
hosts: "{{ rabbitmq_host_group | default('rabbitmq_all') }}[0]"
gather_facts: false
user: root
tasks:
- name: Create rabbitmq user for monitoring GUI
rabbitmq_user:
user: "{{ rabbitmq_monitoring_userid | default('monitoring') }}"
password: "{{ rabbitmq_monitoring_password }}"
tags: "{{ rabbitmq_monitoring_tag | default('monitoring') }}"
state: "present"
no_log: true
when: rabbitmq_monitoring_password is defined
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- rabbitmq-config
- rabbitmq
- name: Importing rabbitmq server playbook
import_playbook: openstack.osa.rabbitmq_server

View File

@ -13,81 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather repo facts
hosts: repo_all
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always
- name: Setup repo servers
hosts: repo_all
gather_facts: false
serial: "{{ repo_serial | default(['1','100%']) }}"
user: root
pre_tasks:
- name: End playbook
meta: end_play
when:
- (install_method | default('source')) != "source"
- name: Including container-setup tasks
include_role:
name: "openstack.osa.{{ container_tech | default('lxc') }}_container_setup"
vars:
list_of_bind_mounts: "{{ repo_container_bind_mounts }}"
when: not is_metal
- name: Including unbound-clients tasks
include_role:
name: openstack.osa.unbound_clients
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
environment: "{{ deployment_environment_variables | default({}) }}"
- name: Setup repo server gluster cluster
hosts: repo_all
gather_facts: false
user: root
tasks:
- name: Create gluster cluster
include_role:
name: openstack.osa.glusterfs
vars:
glusterfs_server_group_name: "repo_all"
glusterfs_server_volume_name: "gfs-repo"
when:
- openstack_repo_server_enable_glusterfs | default(False)
environment: "{{ deployment_environment_variables | default({}) }}"
- name: Configure haproxy services
import_playbook: openstack.osa.haproxy_service_config
vars:
service_group: repo_all
service_variable: "repo_haproxy_services"
when:
- groups[service_group] | length > 0
- groups['haproxy'] | length > 0
tags:
- haproxy-service-config
- name: Setup repo servers
hosts: repo_all
gather_facts: false
serial: "{{ repo_serial | default(['1','100%']) }}"
user: root
pre_tasks:
- name: Setup installation variables
include_role:
name: openstack.osa.install_defaults
defaults_from: "{{ install_method }}"
public: true
apply:
tags:
- always
tags:
- always
roles:
- role: "repo_server"
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- repo-server
- name: Importing repo playbook
import_playbook: openstack.osa.repo

View File

@ -13,51 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Importing pre hook playbook
import_playbook: "{{ pre_setup_infrastructure_hook | default('hook-dummy.yml') }}"
- name: Importing unbound-install playbook
import_playbook: unbound-install.yml
- name: Importing haproxy-install playbook
import_playbook: haproxy-install.yml
- name: Importing repo-install playbook
import_playbook: repo-install.yml
- name: Importing memcached-install playbook
import_playbook: memcached-install.yml
- name: Importing galera-install playbook
import_playbook: galera-install.yml
- name: Importing qdrouterd-install playbook
import_playbook: qdrouterd-install.yml
- name: Importing rabbitmq-install playbook
import_playbook: rabbitmq-install.yml
- name: Importing utility-install playbook
import_playbook: utility-install.yml
- name: Importing zookeeper-install playbook
import_playbook: zookeeper-install.yml
- name: Importing ceph-install playbook
import_playbook: ceph-install.yml
- name: Importing ceph-pools playbook
import_playbook: ceph-pools.yml
- name: Importing ceph-nfs-install playbook
import_playbook: ceph-nfs-install.yml
# The journald-remote should be disabled by default until
# https://github.com/systemd/systemd/issues/2376 has been
# incorporated in current systemd packages
- name: Importing infra-journal-remote playbook
import_playbook: infra-journal-remote.yml
when: journald_remote_enabled | default (false) | bool
- name: Importing post hook playbook
import_playbook: "{{ post_setup_infrastructure_hook | default('hook-dummy.yml') }}"
- name: Importing setup_infrastructure playbook
import_playbook: openstack.osa.setup_infrastructure

View File

@ -13,39 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather unbound facts
hosts: unbound
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always
- name: Install unbound DNS resolvers
hosts: unbound
gather_facts: false
serial: "{{ unbound_serial | default(['1','100%']) }}"
user: root
pre_tasks:
- name: Including container-setup tasks
include_role:
name: "openstack.osa.{{ container_tech | default('lxc') }}_container_setup"
when: not is_metal
roles:
- role: "unbound"
tags:
- unbound_server
- role: "openstack.osa.system_crontab_coordination"
tags:
- "system-crontab-coordination"
- name: Install unbound DNS resolver client configurations
hosts:
- "!unbound"
- "{{ openstack_host_group|default('hosts') }}"
user: root
tasks:
- name: Including unbound-clients tasks
include_role:
name: openstack.osa.unbound_clients
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
environment: "{{ deployment_environment_variables | default({}) }}"
- name: Importing unbound playbook
import_playbook: openstack.osa.unbound

View File

@ -13,165 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather utility facts
hosts: utility_all
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always
- name: Setup the utility location(s)
hosts: utility_all
user: root
gather_facts: false
serial: "{{ utility_serial | default(['1','100%']) }}"
environment: "{{ deployment_environment_variables | default({}) }}"
vars:
utility_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~
requirements_git_install_branch | default('master')) }}"
tags:
- utility
handlers:
- name: Ensure bash completions directory is present
file:
path: "/etc/bash_completion.d"
state: "directory"
mode: "0755"
listen:
- "venv changed"
- name: Create openstack client bash_completion script # noqa: no-changed-when
shell: >-
openstack complete > /etc/bash_completion.d/openstack_client
args:
executable: /bin/bash
listen:
- "venv changed"
pre_tasks:
- name: Setup installation variables
include_role:
name: openstack.osa.install_defaults
defaults_from: "{{ install_method }}"
public: true
apply:
tags:
- always
tags:
- always
- name: Including container-setup tasks
include_role:
name: "openstack.osa.{{ container_tech | default('lxc') }}_container_setup"
when: not is_metal
- name: Including unbound-clients tasks
include_role:
name: openstack.osa.unbound_clients
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- name: Create log directory (not is_metal)
file:
dest: "/var/log/utility"
state: "directory"
force: "yes"
mode: "0755"
when: not is_metal | bool
roles:
- role: "galera_server"
vars:
galera_install_client: true
galera_install_server: false
- role: "openstack_openrc"
tags:
- openrc
post_tasks:
- name: Add OpenStack client to distro packages
set_fact:
utility_distro_packages: "{{ (utility_distro_packages | default([])) + utility_distro_openstack_clients_packages }}"
when: install_method == "distro"
- name: Install distro packages
package:
name: "{{ utility_distro_packages | default([]) }}"
state: "{{ utility_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: Distribute private ssh key
copy:
content: "{{ utility_ssh_private_key }}"
dest: /root/.ssh/id_rsa
mode: "0600"
owner: root
group: root
when: utility_ssh_private_key is defined
- name: Install openstack clients (source-based install)
when:
- install_method == "source"
block:
- name: Get list of repo packages
uri:
url: "{{ utility_upper_constraints_url }}"
return_content: yes
register: _abs_reqs
run_once: true
check_mode: false
ignore_errors: "{{ ansible_check_mode }}"
tags:
- always
- name: Derive the list of openstack clients
set_fact:
_openstack_client_list: >-
{%- set package_list = [] %}
{%- for l in _abs_reqs.content.split('\n') %}
{%- if (l is match('^python-.*client==.*$')) or
(l is match('^(aodh|gnocchi)client==.*$')) or
(l is match('^osc-placement==.*$'))
%}
{%- set _ = package_list.append(l | regex_replace('==.*$', '')) %}
{%- endif %}
{%- endfor %}
{{- package_list }}
run_once: true
tags:
- always
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_python_executable: "{{ utility_venv_python_executable | default(openstack_venv_python_executable) }}"
venv_install_destination_path: "{{ utility_venv_bin | dirname }}"
venv_build_distro_package_list: "{{ utility_devel_distro_packages }}"
venv_pip_install_args: "{{ pip_install_options | default('') }}"
venv_build_constraints:
- "--constraint {{ utility_upper_constraints_url }}"
venv_pip_packages: "{{ _openstack_client_list | union(utility_pip_packages) }}"
- name: Create list of binaries to symlink
set_fact:
_openstack_client_to_symlink: |-
{%- set binary_list = [] %}
{%- for l in _openstack_client_list %}
{%- set _ = binary_list.append(l | regex_replace('^(?:python-)?(\w*)(?:client)$', '\\1')) %}
{%- endfor %}
{{- binary_list }}
run_once: true
- name: Create symlinks for openstack clients
file:
src: "{{ utility_venv_bin }}/{{ item }}"
path: "/usr/local/bin/{{ item }}"
state: link
force: yes
follow: false
with_items:
- "{{ _openstack_client_to_symlink }}"
notify: "Create openstack client bash_completion script"
- name: Importing utility_host playbook
import_playbook: openstack.osa.utility_host

View File

@ -13,31 +13,5 @@
# License for the specific language governing permissions and limitations
# under the License.
- name: Gather zookeeper facts
hosts: zookeeper_all
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always
- name: Install zookeeper
hosts: zookeeper_all
gather_facts: false
serial: "{{ zookeeper_serial | default(['1','100%']) }}"
user: root
environment: "{{ deployment_environment_variables | default({}) }}"
pre_tasks:
- name: Including container-setup tasks
include_role:
name: "openstack.osa.{{ container_tech | default('lxc') }}_container_setup"
when: not is_metal
vars:
list_of_bind_mounts: "{{ zookeeper_container_bind_mounts }}"
roles:
- role: zookeeper
tags:
- zookeeper
- role: "openstack.osa.system_crontab_coordination"
tags:
- crontab
tags:
- zookeeper
- name: Importing zookeeper playbook
import_playbook: openstack.osa.zookeeper