Combine package install tasks
This patch brings over the one-task package installation pattern from the security role and uses async to allow the package install to run while the virtual environment is downloaded/extracted. This should hopefully save time during the gate jobs since the nova KVM package install is one of the longest package install jobs in OSA. It also uses Ansible 2.0's ability to use variables in task includes to avoid running a ton of skipped tasks. Change-Id: I1e9259413d14670cf7f5bbc46eacc15837982779
This commit is contained in:
parent
0b3c1b8765
commit
bdf7eb76a9
@ -24,6 +24,11 @@
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Gather variables that apply to all operating systems
|
||||
include_vars: common.yml
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Fail when virt type is unsupported
|
||||
fail: msg="Unsupported Virt Type Provided {{ nova_supported_virt_types }}"
|
||||
when:
|
||||
|
@ -13,17 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- include: nova_compute_kvm.yml
|
||||
when: nova_virt_type == 'kvm' or nova_virt_type == 'qemu'
|
||||
|
||||
- include: nova_compute_powervm.yml
|
||||
when: nova_virt_type == 'powervm'
|
||||
|
||||
- include: nova_compute_lxd.yml
|
||||
when: nova_virt_type == 'lxd'
|
||||
|
||||
- include: nova_compute_ironic.yml
|
||||
when: nova_virt_type == 'ironic'
|
||||
- include: "nova_compute_{{ nova_virt_type }}.yml"
|
||||
tags:
|
||||
- nova-install
|
||||
|
||||
|
@ -38,21 +38,6 @@
|
||||
tags:
|
||||
- novalink-repo
|
||||
|
||||
- name: Install apt packages
|
||||
apt:
|
||||
pkg: "{{ item }}"
|
||||
state: "{{ nova_package_state }}"
|
||||
update_cache: yes
|
||||
cache_valid_time: "{{ cache_timeout }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ nova_compute_powervm_distro_packages }}"
|
||||
tags:
|
||||
- nova-apt-packages
|
||||
- nova-compute-powervm-apt-packages
|
||||
|
||||
- name: Register pypowervm module path (venv)
|
||||
command: python -c 'import pypowervm; print pypowervm.__file__'
|
||||
changed_when: false
|
||||
|
1
tasks/nova_compute_qemu.yml
Symbolic link
1
tasks/nova_compute_qemu.yml
Symbolic link
@ -0,0 +1 @@
|
||||
nova_compute_kvm.yml
|
@ -13,62 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Ensure apt cache is up to date
|
||||
apt:
|
||||
update_cache: yes
|
||||
cache_valid_time: "{{ cache_timeout }}"
|
||||
when:
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
|
||||
- name: Add Ubuntu Cloud Archive key package
|
||||
package:
|
||||
name: ubuntu-cloud-keyring
|
||||
state: "{{ nova_package_state }}"
|
||||
when:
|
||||
- nova_uca_enable
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
register: nova_uca_add_keys
|
||||
tags:
|
||||
- add-apt-keys
|
||||
|
||||
- name: Add Ubuntu Cloud Archive apt repository
|
||||
apt_repository:
|
||||
repo: "{{ uca_repo }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
filename: "{{ uca_apt_source_list_filename | default(omit) }}"
|
||||
register: nova_uca_add_repo
|
||||
when:
|
||||
- nova_uca_enable
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
until: add_repo|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
tags:
|
||||
- add-uca-repo
|
||||
|
||||
- name: Install RDO package
|
||||
package:
|
||||
name: "{{ rdo_package }}"
|
||||
state: "present"
|
||||
register: install_cloud_rdo_package
|
||||
until: install_cloud_rdo_package | success
|
||||
retries: 5
|
||||
delay: 2
|
||||
when:
|
||||
- ansible_pkg_mgr == 'yum'
|
||||
|
||||
- name: Install distro packages
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: "{{ nova_package_state }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ nova_distro_packages }}"
|
||||
tags:
|
||||
- nova-apt-packages
|
||||
- include: "nova_install_{{ ansible_pkg_mgr }}.yml"
|
||||
|
||||
- name: Remove known problem packages for the Spice console
|
||||
package:
|
||||
@ -86,54 +31,6 @@
|
||||
- nova-apt-packages
|
||||
- nova-spice-apt-packages
|
||||
|
||||
- name: Install distro packages (novnc console)
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: "{{ nova_package_state }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ nova_novnc_distro_packages }}"
|
||||
when:
|
||||
- inventory_hostname in groups['nova_console']
|
||||
- nova_console_type == "novnc"
|
||||
tags:
|
||||
- nova-apt-packages
|
||||
- nova-novnc-apt-packages
|
||||
|
||||
- name: Install distro packages (compute - KVM)
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: "{{ nova_package_state }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ nova_compute_kvm_distro_packages }}"
|
||||
when:
|
||||
- inventory_hostname in groups['nova_compute']
|
||||
- nova_virt_type == 'kvm' or nova_virt_type == 'qemu'
|
||||
tags:
|
||||
- nova-apt-packages
|
||||
- nova-compute-kvm-apt-packages
|
||||
|
||||
- name: Install distro packages (compute - LXD)
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: "{{ nova_package_state }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ nova_compute_lxd_distro_packages }}"
|
||||
when:
|
||||
- inventory_hostname in groups['nova_compute']
|
||||
- nova_virt_type == 'lxd'
|
||||
tags:
|
||||
- nova-apt-packages
|
||||
- nova-compute-lxd-apt-packages
|
||||
|
||||
- name: Create developer mode constraint file
|
||||
copy:
|
||||
dest: "/opt/developer-pip-constraints.txt"
|
||||
@ -145,7 +42,7 @@
|
||||
tags:
|
||||
- nova-pip-packages
|
||||
|
||||
- name: Install requires pip packages
|
||||
- name: Install required pip packages
|
||||
pip:
|
||||
name: "{{ nova_requires_pip_packages }}"
|
||||
state: "{{ nova_pip_package_state }}"
|
||||
@ -230,16 +127,18 @@
|
||||
tags:
|
||||
- nova-pip-packages
|
||||
|
||||
- include: nova_console_spice_install.yml
|
||||
when:
|
||||
- inventory_hostname in groups['nova_console']
|
||||
- nova_console_type == "spice"
|
||||
tags:
|
||||
- nova-spice-console
|
||||
- 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: nova_console_novnc_install.yml
|
||||
- include: "nova_console_{{ nova_console_type }}_install.yml"
|
||||
when:
|
||||
- inventory_hostname in groups['nova_console']
|
||||
- nova_console_type == "novnc"
|
||||
- "{{ 'nova_console' in group_names }}"
|
||||
tags:
|
||||
- nova-novnc-console
|
||||
- nova-spice-console
|
||||
|
54
tasks/nova_install_apt.yml
Normal file
54
tasks/nova_install_apt.yml
Normal file
@ -0,0 +1,54 @@
|
||||
---
|
||||
# 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: Ensure apt cache is up to date
|
||||
apt:
|
||||
update_cache: yes
|
||||
cache_valid_time: "{{ cache_timeout }}"
|
||||
|
||||
- name: Add Ubuntu Cloud Archive key package
|
||||
package:
|
||||
name: ubuntu-cloud-keyring
|
||||
state: "{{ nova_package_state }}"
|
||||
when:
|
||||
- nova_uca_enable
|
||||
register: nova_uca_add_keys
|
||||
tags:
|
||||
- add-apt-keys
|
||||
|
||||
- name: Add Ubuntu Cloud Archive apt repository
|
||||
apt_repository:
|
||||
repo: "{{ uca_repo }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
filename: "{{ uca_apt_source_list_filename | default(omit) }}"
|
||||
register: nova_uca_add_repo
|
||||
when:
|
||||
- nova_uca_enable
|
||||
until: add_repo|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
tags:
|
||||
- add-uca-repo
|
||||
|
||||
- name: Install nova role packages (apt)
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: "{{ nova_package_state }}"
|
||||
with_items:
|
||||
- "{{ nova_packages_list | selectattr('enabled') | sum(attribute='packages', start=[]) }}"
|
||||
register: install_nova_role_packages
|
||||
async: 600
|
||||
poll: 0
|
35
tasks/nova_install_yum.yml
Normal file
35
tasks/nova_install_yum.yml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
# 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 RDO package
|
||||
package:
|
||||
name: "{{ rdo_package }}"
|
||||
state: "present"
|
||||
register: install_cloud_rdo_package
|
||||
until: install_cloud_rdo_package | success
|
||||
retries: 5
|
||||
delay: 2
|
||||
when:
|
||||
- ansible_pkg_mgr == 'yum'
|
||||
|
||||
- name: Install nova role packages (yum)
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: "{{ nova_package_state }}"
|
||||
with_items:
|
||||
- "{{ nova_packages_list | selectattr('enabled') | sum(attribute='packages', start=[]) }}"
|
||||
register: install_nova_role_packages
|
||||
async: 600
|
||||
poll: 0
|
30
vars/common.yml
Normal file
30
vars/common.yml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
# 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.
|
||||
|
||||
# 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: yes
|
Loading…
x
Reference in New Issue
Block a user