From f748c258b6cf6950927a33d1b07fd40d84fa9a18 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Wed, 22 Jul 2020 12:01:53 -0500 Subject: [PATCH] PR #30 follow-up: Default to python3-pip. --- .travis.yml | 5 +++-- README.md | 6 +++--- defaults/main.yml | 2 +- meta/main.yml | 4 ---- molecule/default/converge.yml | 8 ++++++++ tasks/main.yml | 7 ------- vars/CentOS-8.yml | 2 -- 7 files changed, 15 insertions(+), 19 deletions(-) delete mode 100644 vars/CentOS-8.yml diff --git a/.travis.yml b/.travis.yml index 505115a..e2770b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,9 +8,10 @@ env: matrix: - MOLECULE_DISTRO: centos8 - MOLECULE_DISTRO: centos7 - - MOLECULE_DISTRO: fedora29 + - MOLECULE_DISTRO: fedora32 + - MOLECULE_DISTRO: ubuntu2004 - MOLECULE_DISTRO: ubuntu1804 - - MOLECULE_DISTRO: debian9 + - MOLECULE_DISTRO: debian10 install: # Install test dependencies. diff --git a/README.md b/README.md index ec9beb9..5353e55 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,11 @@ On RedHat/CentOS, you may need to have EPEL installed before running this role. Available variables are listed below, along with default values (see `defaults/main.yml`): - pip_package: python-pip + pip_package: python3-pip -The name of the packge to install to get `pip` on the system. You can set to `python3-pip`, for example, when using Python 3 on Ubuntu. +The name of the packge to install to get `pip` on the system. For older systems that don't have Python 3 available, you can set this to `python-pip`. - pip_executable: pip + pip_executable: pip3 The role will try to autodetect the pip executable based on the `pip_package` (e.g. `pip` for Python 2 and `pip3` for Python 3). You can also override this explicitly, e.g. `pip_executable: pip3.6`. diff --git a/defaults/main.yml b/defaults/main.yml index 8a70a1e..e51000b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,6 @@ --- # For Python 3, use python3-pip. -pip_package: python-pip +pip_package: python3-pip pip_executable: "{{ 'pip3' if pip_package.startswith('python3') else 'pip' }}" pip_install_packages: [] diff --git a/meta/main.yml b/meta/main.yml index a67e2bb..908669d 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -22,10 +22,6 @@ galaxy_info: - name: Ubuntu versions: - all - - name: CentOS - versions: - - 7 - - 8 galaxy_tags: - system - server diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 6ffa90b..e0151a5 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -16,5 +16,13 @@ apt: update_cache=true cache_valid_time=600 when: ansible_os_family == 'Debian' + - name: Set package name for older OSes. + set_fact: + pip_package: python-pip + when: > + (ansible_os_family == 'RedHat') and (ansible_distribution_major_version | int < 8) + or (ansible_distribution == 'Debian') and (ansible_distribution_major_version | int < 10) + or (ansible_distribution == 'Ubuntu') and (ansible_distribution_major_version | int < 18) + roles: - role: geerlingguy.pip diff --git a/tasks/main.yml b/tasks/main.yml index e4de8c7..dda7fac 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,11 +1,4 @@ --- -- name: Gather OS specific variables. - include_vars: "{{ item }}" - with_first_found: - - "vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml" - - "vars/{{ ansible_distribution }}.yml" - - "defaults/main.yml" - - name: Ensure Pip is installed. package: name: "{{ pip_package }}" diff --git a/vars/CentOS-8.yml b/vars/CentOS-8.yml deleted file mode 100644 index 2f63896..0000000 --- a/vars/CentOS-8.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -pip_package: python3-pip