diff --git a/tasks/nova_install.yml b/tasks/nova_install.yml index 9eda22af..38d1c7d2 100644 --- a/tasks/nova_install.yml +++ b/tasks/nova_install.yml @@ -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" diff --git a/tasks/nova_install_apt.yml b/tasks/nova_install_apt.yml deleted file mode 100644 index d139ab42..00000000 --- a/tasks/nova_install_apt.yml +++ /dev/null @@ -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 diff --git a/tasks/nova_install_yum.yml b/tasks/nova_install_yum.yml deleted file mode 100644 index 84f9ea63..00000000 --- a/tasks/nova_install_yum.yml +++ /dev/null @@ -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 diff --git a/vars/main.yml b/vars/main.yml index 07ddd9d3..0d7392f2 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -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() %} diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index f6a1656b..452bf84d 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -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 diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml index 5bfeec56..a9d714bd 100644 --- a/vars/ubuntu-16.04.yml +++ b/vars/ubuntu-16.04.yml @@ -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