Normalise distro package installation
This patch makes the distro package list compilation just a little easier to understand, and avoids the double evaluation of the variable. It also adds the spice distro package list which was missing. It also passes the package list directly to the package module instead of using a with_items loop and removes the nested inclusions for distro package installation. Finally, the async process for installing the packages is removed as it doesn't give much benefit in terms of speed and instead obscures the process a little. Change-Id: I910868db9780d9b56eabf5f059fe2f6d32719238
This commit is contained in:
parent
234ec64b13
commit
3c573ae564
@ -13,7 +13,19 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- include: "nova_install_{{ ansible_pkg_mgr }}.yml"
|
||||
- name: Setup powervm repository
|
||||
include: nova_install_apt_powervm.yml
|
||||
when:
|
||||
- "'nova_compute' in group_names"
|
||||
- "nova_virt_type == 'powervm'"
|
||||
- "ansible_pkg_mgr == 'apt'"
|
||||
|
||||
- name: Install distro packages
|
||||
package:
|
||||
name: "{{ nova_package_list }}"
|
||||
state: "{{ nova_package_state }}"
|
||||
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
|
||||
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
|
||||
|
||||
- name: Remove known problem packages for the Spice console
|
||||
package:
|
||||
@ -145,15 +157,6 @@
|
||||
tags:
|
||||
- nova-pip-packages
|
||||
|
||||
- name: Ensure distro packages are fully installed on all hosts
|
||||
async_status:
|
||||
jid: "{{ item.ansible_job_id }}"
|
||||
register: install_nova_role_packages_async_job
|
||||
until: install_nova_role_packages_async_job.finished
|
||||
retries: 300
|
||||
with_items:
|
||||
- "{{ install_nova_role_packages.results }}"
|
||||
|
||||
- include: "consoles/nova_console_{{ nova_console_type }}_install.yml"
|
||||
when:
|
||||
- "'nova_console' in group_names"
|
||||
|
@ -1,37 +0,0 @@
|
||||
---
|
||||
# Copyright 2017, Rackspace US, 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.
|
||||
|
||||
# Only PowerVM needs to load a separate file. Skip for the others.
|
||||
- include: "{{ item }}"
|
||||
with_first_found:
|
||||
- files:
|
||||
- "nova_install_apt_{{ nova_virt_type }}.yml"
|
||||
skip: true
|
||||
tags:
|
||||
- nova-install
|
||||
|
||||
- name: Install nova role packages (apt)
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: "{{ nova_package_state }}"
|
||||
update_cache: yes
|
||||
cache_valid_time: "{{ cache_timeout }}"
|
||||
with_items:
|
||||
- "{{ nova_packages_list | selectattr('enabled') | sum(attribute='packages', start=[]) }}"
|
||||
when:
|
||||
- item != ''
|
||||
register: install_nova_role_packages
|
||||
async: 600
|
||||
poll: 0
|
@ -1,26 +0,0 @@
|
||||
---
|
||||
# Copyright 2017, Rackspace US, 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: Install nova role packages (yum)
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: "{{ nova_package_state }}"
|
||||
with_items:
|
||||
- "{{ nova_packages_list | selectattr('enabled') | sum(attribute='packages', start=[]) }}"
|
||||
when:
|
||||
- item != ''
|
||||
register: install_nova_role_packages
|
||||
async: 600
|
||||
poll: 0
|
@ -13,22 +13,42 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This special list brings together all of the package installations into one
|
||||
# task to save time and allow for async to work.
|
||||
nova_packages_list:
|
||||
- packages: "{{ nova_distro_packages }}"
|
||||
enabled: yes
|
||||
- packages: "{{ nova_novnc_distro_packages }}"
|
||||
enabled: "{{ 'nova_console' in group_names and nova_console_type == 'novnc' }}"
|
||||
- packages: "{{ nova_compute_kvm_distro_packages }}"
|
||||
enabled: "{{ 'nova_compute' in group_names and nova_virt_type in ['kvm', 'qemu'] }}"
|
||||
- packages: "{{ nova_compute_lxd_distro_packages }}"
|
||||
enabled: "{{ 'nova_compute' in group_names and nova_virt_type == 'lxd' }}"
|
||||
- packages: "{{ nova_compute_powervm_distro_packages }}"
|
||||
enabled: "{{ 'nova_compute' in group_names and nova_virt_type == 'powervm' }}"
|
||||
- packages: "{{ nova_nginx_distro_packages }}"
|
||||
enabled: "{{ 'nova_api_placement' in group_names }}"
|
||||
#
|
||||
# Compile a list of the distro packages to install based on
|
||||
# whether the host is in the host group and the service is
|
||||
# enabled.
|
||||
#
|
||||
nova_package_list: |-
|
||||
{% set packages = nova_distro_packages %}
|
||||
{% if 'nova_console' in group_names %}
|
||||
{% if nova_console_type == 'novnc' %}
|
||||
{% set _ = packages.extend(nova_novnc_distro_packages) %}
|
||||
{% endif %}
|
||||
{% if nova_console_type == 'spice' %}
|
||||
{% set _ = packages.extend(nova_spice_distro_packages) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if 'nova_compute' in group_names %}
|
||||
{% if nova_virt_type in ['kvm', 'qemu'] %}
|
||||
{% set _ = packages.extend(nova_compute_kvm_distro_packages) %}
|
||||
{% elif nova_virt_type == 'lxd' %}
|
||||
{% set _ = packages.extend(nova_compute_lxd_distro_packages) %}
|
||||
{% elif nova_virt_type == 'powervm' %}
|
||||
{% set _ = packages.extend(nova_compute_powervm_distro_packages) %}
|
||||
{% endif %}
|
||||
{% if nova_barbican_enabled | bool %}
|
||||
{% set _ = packages.extend(nova_compute_barbican_distro_packages) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if 'nova_api_placement' in group_names %}
|
||||
{% set _ = packages.extend(nova_nginx_distro_packages) %}
|
||||
{% endif %}
|
||||
{{ packages }}
|
||||
|
||||
#
|
||||
# Compile a list of the services on a host based on whether
|
||||
# the host is in the host group and the service is enabled.
|
||||
#
|
||||
filtered_nova_services: >
|
||||
{%- set services = nova_services.copy() %}
|
||||
{%- for key,value in nova_services.items() %}
|
||||
|
@ -36,9 +36,11 @@ nova_novnc_distro_packages:
|
||||
- librabbitmq
|
||||
- libyaml
|
||||
|
||||
nova_compute_barbican_distro_packages:
|
||||
- cryptsetup
|
||||
|
||||
nova_compute_kvm_distro_packages:
|
||||
- bridge-utils
|
||||
- "{% if nova_barbican_enabled | bool %}cryptsetup{% endif %}"
|
||||
- device-mapper-multipath
|
||||
- dosfstools
|
||||
- genisoimage
|
||||
|
@ -38,9 +38,11 @@ nova_novnc_distro_packages:
|
||||
- librabbitmq4
|
||||
- libyaml-0-2
|
||||
|
||||
nova_compute_barbican_distro_packages:
|
||||
- cryptsetup
|
||||
|
||||
nova_compute_kvm_distro_packages:
|
||||
- bridge-utils
|
||||
- "{% if nova_barbican_enabled | bool %}cryptsetup{% endif %}"
|
||||
- genisoimage
|
||||
- kpartx
|
||||
- libvirt-bin
|
||||
@ -58,7 +60,6 @@ nova_compute_kvm_distro_packages:
|
||||
|
||||
nova_compute_lxd_distro_packages:
|
||||
- bridge-utils
|
||||
- "{% if nova_barbican_enabled | bool %}cryptsetup{% endif %}"
|
||||
- dosfstools
|
||||
- dosfstools-dbg
|
||||
- genisoimage
|
||||
@ -78,7 +79,6 @@ nova_nginx_distro_packages:
|
||||
# nova powervm virt driver
|
||||
nova_compute_powervm_distro_packages:
|
||||
- bridge-utils
|
||||
- "{% if nova_barbican_enabled | bool %}cryptsetup{% endif %}"
|
||||
- genisoimage
|
||||
- kpartx
|
||||
- open-iscsi
|
||||
|
Loading…
x
Reference in New Issue
Block a user