From 899e838419b9377f24e9f282ebd8fca889f24fe1 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Mon, 23 Apr 2018 16:48:28 +0100 Subject: [PATCH] tasks: Use PIP distribution packages for openSUSE and Ubuntu Supported openSUSE and Ubuntu distributions ship with relatively new pip, setuptools, virtualenv and wheel packages so we can use that in favor of the PIP ones. This also avoids running the pip_install role on these hosts making the deployment somewhat faster. Implements: blueprint openstack-distribution-packages Change-Id: I424ca9ca71253cc4e673065f35c9b939942eeda3 --- defaults/main.yml | 3 +++ .../use-pip-distro-packages-2505f6e630a94850.yaml | 6 ++++++ tasks/main.yml | 11 +++++++++++ vars/redhat-7.yml | 2 ++ vars/suse-42.yml | 7 +++++++ vars/ubuntu-16.04.yml | 11 +++++++++++ 6 files changed, 40 insertions(+) create mode 100644 releasenotes/notes/use-pip-distro-packages-2505f6e630a94850.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 8d0dc542..7193b71b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -131,6 +131,9 @@ global_environment_variables: {} # Set the default mode for the /etc/cron.d/sysstat file openstack_host_sysstat_cron_mode: '0755' +# Distribution packages required for using pip on the host +openstack_host_pip_packages: "{{ _openstack_host_pip_packages | default([]) }}" + ## Default repositories data # Set default mirror for CentOS repositories # NOTE(mhayden): Ensure that the full path to the 'centos' directory is used. diff --git a/releasenotes/notes/use-pip-distro-packages-2505f6e630a94850.yaml b/releasenotes/notes/use-pip-distro-packages-2505f6e630a94850.yaml new file mode 100644 index 00000000..92099e07 --- /dev/null +++ b/releasenotes/notes/use-pip-distro-packages-2505f6e630a94850.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Supported openSUSE and Ubuntu hosts ship with new enough pip, + setuptools, virtualenv and wheel packages which are now being + used in favor of the PIP ones. diff --git a/tasks/main.yml b/tasks/main.yml index d2c769c8..964bab06 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -72,9 +72,20 @@ - name: Run the pip install role include_role: name: pip_install + when: not openstack_host_use_distro_pip tags: - openstack_hosts-install +- name: Install PIP distribution packages + package: + name: "{{ openstack_host_pip_packages }}" + state: "{{ openstack_hosts_package_state }}" + when: openstack_host_use_distro_pip + register: install_packages + until: install_packages | success + retries: 5 + delay: 2 + - include_tasks: openstack_authorized_keys.yml tags: - openstack_hosts-config diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index f0cce8da..4eaabde9 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -22,6 +22,8 @@ openstack_host_module_file: /etc/modules-load.d/openstack-ansible.conf openstack_host_sysstat_cron_mode: '0600' +openstack_host_use_distro_pip: false + ## Kernel modules loaded on hosts openstack_host_kernel_modules: - name: 8021q diff --git a/vars/suse-42.yml b/vars/suse-42.yml index 31d4b5d7..db4f1599 100644 --- a/vars/suse-42.yml +++ b/vars/suse-42.yml @@ -27,6 +27,13 @@ openstack_host_module_file: /etc/modules-load.d/openstack-ansible.conf openstack_host_sysstat_cron_mode: '0644' +openstack_host_use_distro_pip: true +_openstack_host_pip_packages: + - python-pip + - python-setuptools + - python-virtualenv + - python-wheel + ## Kernel modules loaded on hosts openstack_host_kernel_modules: - name: 8021q diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml index 076965aa..bb0869a3 100644 --- a/vars/ubuntu-16.04.yml +++ b/vars/ubuntu-16.04.yml @@ -16,6 +16,17 @@ ## APT Cache Options cache_timeout: 600 +openstack_host_use_distro_pip: true +_openstack_host_pip_packages: + - python-pip + - python3-pip + - python-setuptools + - python3-setuptools + - python-virtualenv + - python3-virtualenv + - python-wheel + - python3-wheel + ## Defined required kernel openstack_host_required_kernel: 4.4.0-0-generic openstack_host_sysstat_file: /etc/default/sysstat