Optimize pip_install

This patch optimizes the pip_install tasks to avoid lots of skipped
tasks. This role is run *many* times during the integrated gate and
adds a signficant amount of time to gate jobs.

Installing the RDO RPM still takes quite a bit of time (~ 6min) in
the integrated build, so further optimization is needed.

Change-Id: I3e127a4451a0ab47588a213e9721bc2f36b12387
This commit is contained in:
Major Hayden 2017-02-28 11:50:49 -06:00
parent 3a6cc1a44c
commit badf502951
No known key found for this signature in database
GPG Key ID: 737051E0C1011FB1
4 changed files with 135 additions and 111 deletions

View File

@ -15,10 +15,4 @@
- include: pre_install.yml
- include: install_online.yml
static: no
when: not pip_offline_install | bool
- include: install_offline.yml
static: no
when: pip_offline_install | bool
- include: "install_{{ pip_offline_install | ternary('offline', 'online') }}.yml"

View File

@ -13,13 +13,6 @@
# 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: Remove known problem packages
package:
name: "{{ item }}"
@ -30,103 +23,7 @@
delay: 2
with_items: "{{ pip_install_remove_distro_packages }}"
# Under CentOS, this will add the repo and its key to the keyring
# Under Ubuntu, this will only add the key
# Under SUSE, it will do nothing
- name: Install external repo key with package
package:
name: "{{ pip_install_external_repo_key_package }}"
state: "{{ pip_install_external_repo_key_package_state | default('present') }}"
when:
- user_external_repo_key is not defined
- ansible_pkg_mgr != 'zypper'
tags:
- add-repo-keys
- name: Install repo for distro binaries
apt_repository:
repo: "{{ uca_repo }}"
state: present
update_cache: yes
filename: "{{ uca_apt_source_list_filename | default(omit) }}"
register: uca_add_repo
until: uca_add_repo|success
retries: 5
delay: 2
when:
- ansible_pkg_mgr == 'apt'
- uca_enable
tags:
- add-uca-repo
- name: Install external repo key manually (apt)
apt_key:
id: "{{ item.id | default(omit) }}"
keyserver: "{{ item.keyserver | default(omit) }}"
url: "{{ item.url | default(omit) }}"
state: "{{ item.state | default('present') }}"
register: add_keys
until: add_keys|success
retries: 5
delay: 2
with_items: "{{ user_external_repo_keys_list }}"
when:
- ansible_pkg_mgr == 'apt'
- user_external_repo_keys_list is defined
tags:
- add-repo-keys
- name: Install external repo key manually (rpm)
rpm_key:
key: "{{ item.key }}"
validate_certs: "{{ item.validate_certs | default(omit) }}"
state: "{{ item.state | default('present') }}"
register: add_keys
until: add_keys|success
retries: 5
delay: 2
with_items: "{{ user_external_repo_keys_list }}"
when:
- ansible_pkg_mgr == 'yum'
- user_external_repo_keys_list is defined
tags:
- add-repo-keys
- name: Install external repo manually (apt)
apt_repository:
repo: "{{ item.repo }}"
state: "{{ item.state | default('present') }}"
update_cache: yes
filename: "{{ item.filename | default(omit) }}"
register: use_external_repo_apt
until: use_external_repo_apt|success
retries: 5
delay: 2
with_items: "{{ user_external_repos_list }}"
when:
- ansible_pkg_mgr == 'apt'
- user_external_repos_list is defined
tags:
- add-external-repo
- name: Install external repo manually (yum)
yum_repository:
name: "{{ item.name }}"
description: "{{ item.description | default(omit) }}"
baseurl: "{{ item.baseurl | default(omit) }}"
gpgkey: "{{ item.gpgkey | default(omit) }}"
gpgcheck: "{{ item.gpgcheck | default(omit) }}"
enabled: "{{ item.enabled | default('yes') }}"
register: use_external_repo_yum
until: use_external_repo_yum|success
retries: 5
delay: 2
with_items: "{{ user_external_repos_list }}"
when:
- ansible_pkg_mgr == 'yum'
- user_external_repos_list is defined
tags:
- add-external-repo
- include: "pre_install_{{ ansible_pkg_mgr }}.yml"
- name: Install packages
package:

76
tasks/pre_install_apt.yml Normal file
View File

@ -0,0 +1,76 @@
---
# 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 }}"
# Under Ubuntu, this will only add the key
- name: Install external repo key with package
apt:
name: "{{ pip_install_external_repo_key_package }}"
state: "{{ pip_install_external_repo_key_package_state | default('present') }}"
when:
- user_external_repo_key is not defined
tags:
- add-repo-keys
- name: Install repo for distro binaries
apt_repository:
repo: "{{ uca_repo }}"
state: present
update_cache: yes
filename: "{{ uca_apt_source_list_filename | default(omit) }}"
register: uca_add_repo
until: uca_add_repo|success
retries: 5
delay: 2
when:
- uca_enable
tags:
- add-uca-repo
- name: Install external repo key manually (apt)
apt_key:
id: "{{ item.id | default(omit) }}"
keyserver: "{{ item.keyserver | default(omit) }}"
url: "{{ item.url | default(omit) }}"
state: "{{ item.state | default('present') }}"
register: add_keys
until: add_keys|success
retries: 5
delay: 2
with_items: "{{ user_external_repo_keys_list }}"
when:
- user_external_repo_keys_list is defined
tags:
- add-repo-keys
- name: Install external repo manually (apt)
apt_repository:
repo: "{{ item.repo }}"
state: "{{ item.state | default('present') }}"
update_cache: yes
filename: "{{ item.filename | default(omit) }}"
register: use_external_repo_apt
until: use_external_repo_apt|success
retries: 5
delay: 2
with_items: "{{ user_external_repos_list }}"
when:
- user_external_repos_list is defined
tags:
- add-external-repo

57
tasks/pre_install_yum.yml Normal file
View File

@ -0,0 +1,57 @@
---
# 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.
# Under CentOS, this will add the repo and its key to the keyring
- name: Install external repo key with package
yum:
name: "{{ pip_install_external_repo_key_package }}"
state: "{{ pip_install_external_repo_key_package_state | default('present') }}"
when:
- user_external_repo_key is not defined
tags:
- add-repo-keys
- name: Install external repo key manually
rpm_key:
key: "{{ item.key }}"
validate_certs: "{{ item.validate_certs | default(omit) }}"
state: "{{ item.state | default('present') }}"
register: add_keys
until: add_keys|success
retries: 5
delay: 2
with_items: "{{ user_external_repo_keys_list }}"
when:
- user_external_repo_keys_list is defined
tags:
- add-repo-keys
- name: Install external repo manually
yum_repository:
name: "{{ item.name }}"
description: "{{ item.description | default(omit) }}"
baseurl: "{{ item.baseurl | default(omit) }}"
gpgkey: "{{ item.gpgkey | default(omit) }}"
gpgcheck: "{{ item.gpgcheck | default(omit) }}"
enabled: "{{ item.enabled | default('yes') }}"
register: use_external_repo_yum
until: use_external_repo_yum|success
retries: 5
delay: 2
with_items: "{{ user_external_repos_list }}"
when:
- user_external_repos_list is defined
tags:
- add-external-repo