Project

Profile

Help

Issue #5705

closed

ansible-pulp fails to install epel-release on CentOS7

Added by evgeni over 4 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

ansible-pulp (86a19f7) contains logic in the pulp role to install epel-release, however, this fails for me with Ansible 2.8.5 (Fedora 30):

% vagrant up pulp3-sandbox-centos7 --provision
Bringing machine 'pulp3-sandbox-centos7' up with 'libvirt' provider...
==> pulp3-sandbox-centos7: Checking if box 'centos/7' version '1905.1' is up to date...
==> pulp3-sandbox-centos7: Running provisioner: main0 (ansible)...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.8.5).

Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode

    pulp3-sandbox-centos7: Running ansible-galaxy...
- changing role geerlingguy.postgresql from 2.0.1 to unspecified
- downloading role 'postgresql', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-postgresql/archive/2.0.1.tar.gz
- extracting geerlingguy.postgresql to /home/egolov/Devel/pulp/pulplift/playbooks/roles/geerlingguy.postgresql
- geerlingguy.postgresql (2.0.1) was installed successfully
    pulp3-sandbox-centos7: Running ansible-playbook...

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [pulp3-sandbox-centos7]

TASK [include_vars] ************************************************************
ok: [pulp3-sandbox-centos7] => (item=/home/egolov/Devel/pulp/pulplift/playbooks/../example.user-config.yml)

TASK [Verify Ansible meets min required version] *******************************
ok: [pulp3-sandbox-centos7] => {
    "changed": false
}

MSG:

All assertions passed

TASK [Update Fedora 30 dnf stack] **********************************************
skipping: [pulp3-sandbox-centos7]

TASK [pulp : Fail when pulp_secret_key is not set] *****************************
ok: [pulp3-sandbox-centos7] => {
    "changed": false
}

MSG:

All assertions passed

TASK [pulp : Load OS specific variables] ***************************************
ok: [pulp3-sandbox-centos7]

TASK [pulp : Enumerate default system PATH] ************************************
skipping: [pulp3-sandbox-centos7]

TASK [pulp : set the default system PATH as a fact] ****************************
ok: [pulp3-sandbox-centos7]

TASK [pulp : include_tasks] ****************************************************
skipping: [pulp3-sandbox-centos7] => (item=rhui-rhel-7-server-rhui-optional-rpms) 
skipping: [pulp3-sandbox-centos7] => (item=rhel-7-server-optional-rpms) 
skipping: [pulp3-sandbox-centos7] => (item=rhel-7-workstation-optional-rpms) 

TASK [pulp : Update apt package index] *****************************************
skipping: [pulp3-sandbox-centos7]

TASK [pulp : Install EPEL Release] *********************************************
ok: [pulp3-sandbox-centos7] => (item=['epel-release', 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm'])

TASK [pulp : Install prerequisites] ********************************************
fatal: [pulp3-sandbox-centos7]: FAILED! => {
    "changed": false,
    "rc": 126,
    "results": [
        "libselinux-python-2.5-14.1.el7.x86_64 providing libselinux-python is already installed",
        "No package matching 'python-contextlib2' found available, installed or updated"
    ]
}

MSG:

No package matching 'python-contextlib2' found available, installed or updated

PLAY RECAP *********************************************************************
pulp3-sandbox-centos7      : ok=7    changed=0    unreachable=0    failed=1    skipped=4    rescued=0    ignored=0   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

See how the install step says no changes?

Actions #1

Updated by mdepaulo@redhat.com over 4 years ago

It looks like vagrant installs epel-release (with the rpm command, not yum) before it installs fuse-sshfs:

$ vagrant ssh pulp3-sandbox-centos7
[vagrant@pulp3-sandbox-centos7 ~]$ rpm -qi epel-release
Name : epel-release
Version : 7
Release : 12
Architecture: noarch
*Install Date: Wed 13 Nov 2019 03:03:06 PM UTC
*Group : System Environment/Base
Size : 25032
License : GPLv2
Signature : RSA/SHA256, Wed 18 Sep 2019 12:56:09 PM UTC, Key ID 6a2faea2352c64e5
Source RPM : epel-release-7-12.src.rpm
Build Date : Tue 17 Sep 2019 11:26:40 PM UTC
Build Host : buildvm-23.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager : Fedora Project
Vendor : Fedora Project
URL : http://download.fedoraproject.org/pub/epel
Bug URL : https://bugz.fedoraproject.org/epel-release
Summary : Extra Packages for Enterprise Linux repository configuration
Description :
This package contains the Extra Packages for Enterprise Linux (EPEL) repository
GPG key as well as configuration for yum.
[vagrant@pulp3-sandbox-centos7 log]$ sudo cat /var/log/yum.log
*Nov 13 15:03:13 Installed: fuse-sshfs-2.10-1.el7.x86_64
*Nov 13 15:03:33 Installed: python3-pip-9.0.3-5.el7.noarch
Nov 13 15:03:33 Installed: python3-setuptools-39.2.0-10.el7.noarch
Nov 13 15:03:33 Installed: python3-3.6.8-10.el7.x86_64
Nov 13 15:03:35 Installed: python3-libs-3.6.8-10.el7.x86_64
Nov 13 15:03:35 Installed: python-srpm-macros-3-32.el7.noarch
Nov 13 15:03:35 Installed: python-rpm-macros-3-32.el7.noarch
Nov 13 15:03:35 Installed: python3-rpm-generators-6-2.el7.noarch
Nov 13 15:03:35 Installed: 1:perl-parent-0.225-244.el7.noarch
Nov 13 15:03:35 Installed: perl-HTTP-Tiny-0.033-3.el7.noarch
Nov 13 15:03:36 Installed: perl-podlators-2.5.1-3.el7.noarch
Nov 13 15:03:36 Installed: perl-Pod-Perldoc-3.20-4.el7.noarch
Nov 13 15:03:36 Installed: 1:perl-Pod-Escapes-1.04-294.el7_6.noarch
Nov 13 15:03:36 Installed: perl-Text-ParseWords-3.29-4.el7.noarch
Nov 13 15:03:36 Installed: perl-Encode-2.51-7.el7.x86_64
Nov 13 15:03:36 Installed: perl-Pod-Usage-1.63-3.el7.noarch
Nov 13 15:03:36 Installed: 4:perl-libs-5.16.3-294.el7_6.x86_64
Nov 13 15:03:37 Installed: perl-threads-1.87-4.el7.x86_64
Nov 13 15:03:37 Installed: 4:perl-Time-HiRes-1.9725-3.el7.x86_64
Nov 13 15:03:37 Installed: perl-Exporter-5.68-3.el7.noarch
Nov 13 15:03:37 Installed: perl-constant-1.27-2.el7.noarch
Nov 13 15:03:37 Installed: perl-Time-Local-1.2300-2.el7.noarch
Nov 13 15:03:37 Installed: perl-Carp-1.26-244.el7.noarch
Nov 13 15:03:37 Installed: perl-Storable-2.45-3.el7.x86_64
Nov 13 15:03:37 Installed: perl-threads-shared-1.43-6.el7.x86_64
Nov 13 15:03:37 Installed: perl-PathTools-3.40-5.el7.x86_64
Nov 13 15:03:37 Installed: perl-Scalar-List-Utils-1.27-248.el7.x86_64
Nov 13 15:03:37 Installed: perl-File-Temp-0.23.01-3.el7.noarch
Nov 13 15:03:37 Installed: perl-File-Path-2.09-2.el7.noarch
Nov 13 15:03:37 Installed: 4:perl-macros-5.16.3-294.el7_6.x86_64
Nov 13 15:03:37 Installed: perl-Filter-1.49-3.el7.x86_64
Nov 13 15:03:37 Installed: perl-Socket-2.010-4.el7.x86_64
Nov 13 15:03:38 Installed: 1:perl-Pod-Simple-3.28-4.el7.noarch
Nov 13 15:03:38 Installed: perl-Getopt-Long-2.40-3.el7.noarch
Nov 13 15:03:39 Installed: 4:perl-5.16.3-294.el7_6.x86_64
Nov 13 15:03:39 Installed: postgresql-libs-9.2.24-1.el7_5.x86_64
Nov 13 15:03:39 Installed: dwz-0.11-3.el7.x86_64
Nov 13 15:03:39 Installed: python-ipaddress-1.0.16-2.el7.noarch
Nov 13 15:03:39 Installed: zip-3.0-11.el7.x86_64
Nov 13 15:03:40 Installed: python-backports-1.0-8.el7.x86_64
Nov 13 15:03:40 Installed: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
Nov 13 15:03:40 Installed: python3-rpm-macros-3-32.el7.noarch
Nov 13 15:03:40 Installed: perl-srpm-macros-1-8.el7.noarch
Nov 13 15:03:40 Installed: redhat-rpm-config-9.1.0-88.el7.centos.noarch
Nov 13 15:03:40 Installed: python3-devel-3.6.8-10.el7.x86_64
Nov 13 15:03:40 Installed: python-setuptools-0.9.8-7.el7.noarch
Nov 13 15:03:40 Installed: python-psycopg2-2.5.1-4.el7.x86_64
Nov 13 15:03:41 Installed: python-contextlib2-0.5.1-3.el7.noarch
Nov 13 15:03:47 Installed: 1:perl-Error-0.17020-2.el7.noarch
Nov 13 15:03:47 Installed: perl-TermReadKey-2.30-20.el7.x86_64
Nov 13 15:03:48 Installed: git-1.8.3.1-20.el7.x86_64
Nov 13 15:03:48 Installed: perl-Git-1.8.3.1-20.el7.noarch

What I think is happening is that your VM cannot access the internet. Please test:
vagrant ssh pulp3-sandbox-centos7
sudo yum makecache

As I was trying to reproduce this (I added an epel-release remove task to playbooks/user-sandbox.yml), I did notice an issue with the EPEL install task. It is caused by:
1. The task trying to install both package URLs at once rather than sequentially.
2. The CentOS version (epel-release) being behind the EPEL version (the URL). I will writ a separate issue. I was able to reproduce it by running this:
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm epel-release
However, that is not what you are experiencing.
I will write it up as a separate issue

Actions #2

Updated by mdepaulo@redhat.com over 4 years ago

Actually, I just realized that your issue is present. I had modified the ansible task "Install EPEL Release" for the sake of debugging. In doing so, it caused the task to verbosely fail, rather than silently fail & report "OK".

I'm looking into this now. It is likely the same issue that I thought was a separate one.

I recommend you work around this in the meantime by setting this in local.user-config.yml:
epel_release_packages:
- epel-release

Actions #3

Updated by mdepaulo@redhat.com over 4 years ago

Here's a proper fix for both issues (the lack of a task failure code, and the fact that the task fails):
https://github.com/pulp/ansible-pulp/pull/189

Actions #4

Updated by evgeni over 4 years ago

My VM has working network, but I don't have/use the sshfs plugin at all.

I think your fix for flattening the list is correct. However I don't understand why it has to be a list in the first place. Why don't we just always use the URL (on both centos and rhel) or use different defaults per OS? That would make the task much more readable and robust.

On November 13, 2019 6:23:03 PM GMT+01:00, Pulp <> wrote:

Actions #5

Updated by mdepaulo@redhat.com over 4 years ago

  • Assignee set to mdepaulo@redhat.com
Actions #6

Updated by mdepaulo@redhat.com over 4 years ago

evgeni wrote:

My VM has working network, but I don't have/use the sshfs plugin at all.

I think your fix for flattening the list is correct. However I don't understand why it has to be a list in the first place. Why don't we just always use the URL (on both centos and rhel) or use different defaults per OS? That would make the task much more readable and robust.

Hi evgeni,

You are right that it would be much simpler code to use defaults per OS. In hindsight, my time spent implementing the current solution was probably not worth it.

However, I did it this way because:
1. I dislike having to reach out to the internet and download an RPM when it is already in the repos, or already installed.
2. Labs/environments with no internet access.
3. It also literally interferes with using pulp/katello to manage a system's repos.
4. A URL also causes the package to be upgraded. (the ansible installer normally does not upgrade RPMs, and normally your ansible roles should not.)

Added by Mike DePaulo over 4 years ago

Revision 9eb1a4eb | View on GitHub

Problem: ansible-pulp fails to install epel-release on CentOS7

When the epel-release version in CentOS is older than the version on the internet-accessible URL.

solution: Fix the loop trying only 1 item at a time.

Also fix the related issue of it not counting yum rc 1 as an error.

fixes: #5705 ansible-pulp fails to install epel-release on CentOS7 https://pulp.plan.io/issues/5705

Added by Mike DePaulo over 4 years ago

Revision 9eb1a4eb | View on GitHub

Problem: ansible-pulp fails to install epel-release on CentOS7

When the epel-release version in CentOS is older than the version on the internet-accessible URL.

solution: Fix the loop trying only 1 item at a time.

Also fix the related issue of it not counting yum rc 1 as an error.

fixes: #5705 ansible-pulp fails to install epel-release on CentOS7 https://pulp.plan.io/issues/5705

Actions #7

Updated by Anonymous over 4 years ago

  • Status changed from NEW to MODIFIED
Actions #8

Updated by mdepaulo@redhat.com over 4 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Confirmed working by evgeni.

And I tested it as part of standing up a dev instance on AWS.

Also available in: Atom PDF