CentOS repository patching

22 views
Skip to first unread message

Snehal Mehar

unread,
Jun 23, 2020, 8:31:38 AM6/23/20
to Ansible Project
Hello,

I need help with setting up Centos client-server with centos repository URL. It should add a repository URL to the client-server and patch to the next available version identifying the existing os version. 

I have created a role but the patching task gets failed because of no mirrors found. Any help here would be appreciated. 

===========================================================================================================================
main.yml code:

- name: Perform Patch
  include_tasks: centos.yml
  when: ansible_distribution == "CentOS"

- name: Perform Patch
  include_tasks: redhat.yml
  when: ansible_distribution == "RedHat"

- name: Perform Patch
  include_tasks: ubuntu.yml
  when: ansible_distribution == "Ubuntu" or ansible_distribution == "Debian"

- name: Perform Patch
  include_tasks: suse.yml
  when: ansible_distribution == "openSUSE Leap"

==================================================================================================================================================
centos.yml code: 

  - name: Enable centos repo in yum

    template:

      src: centos.repo.j2

      dest: /etc/yum.repos.d/CentOS-Base.repo


  - name: Check Dist Version

    shell: cat /etc/redhat-release

    register: response



  - name: Contents of the register

    debug: msg="{{ response.stdout }}"



  - name: Distribution

    debug: msg="{{ ansible_distribution }}"



  - name: Distribution version

    debug: msg="{{ ansible_distribution_version}}"



  - name: Distribution major version

    debug: msg="{{ ansible_distribution_major_version }}"



  - name: Upgrade all installed packages for CentOS

    yum:

      name: "*"

      state: latest

    when: ansible_distribution == "CentOS"
=================================================================================================================================================

centos.repo.j2 file in template:

[base]
name = CentOS
baseurl = http://mirror.centos.org/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/updates/{{ ansible_architecture }}
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
gpgcheck = 1
enabled = 1

==================================================================================================================================================

Error:

TASK [template.patching : Upgrade all installed packages for CentOS] **************************************************************
fatal: [waldevprodcen02]: FAILED! => {"changed": true, "changes": {"installed": [], "updated": [["freerdp-libs", "2.0.0-4.rc4.el7_8.x86_64 from base"] Not found\nError: Package: vinagre-3.22.0-9.el7.x86_64 (@anaconda)\n           Requires: libfreerdp-utils.so.1.0()(64bit)\n           Removing: freerdp-libs-1.0.2-15.el7.x86_64 (@anaconda)\n               libfreerdp-utils.so.1.0()(64bit)\n           Updated By: freerdp-libs-2.0.0-4.rc4.el7_8.x86_64 (base)\n               Not found\nError: Package: mesa-libxatracker-18.3.4-7.el7_8.1.x86_64 (base)\n           Requires: libLLVM-7-rhel.so(LLVM_7)(64bit)\nError: Package: 1:java-1.7.0-openjdk-headless-1.7.0.261-2.6.22.2.el7_8.x86_64 (base)\n           Requires: nss-softokn(x86-64) >= 3.44.0\n           Installed: nss-softokn-3.36.0-5.el7_5.x86_64 (@anaconda)\n               nss-softokn(x86-64) = 3.36.0-5.el7_5\nError: Package: vinagre-3.22.0-9.el7.x86_64 (@anaconda)\n           Requires: libfreerdp-rail.so.1.0()(64bit)\n           Removing: freerdp-libs-1.0.2-15.el7.x86_64 (@anaconda)\n               libfreerdp-rail.so.1.0()(64bit)\n           Updated By: freerdp-libs-2.0.0-4.rc4.el7_8.x86_64 (base)\n               Not found\nError: Package: 12:dhclient-4.2.5-68.el7.centos.1.x86_64 (@anaconda)\n           Requires: libisc-export.so.95()(64bit)\n           Removing: 32:bind-libs-lite-9.9.4-72.el7.x86_64 (@anaconda)\n               libisc-export.so.95()(64bit)\n           Updated By: 32:bind-libs-lite-9.11.4-16.P2.el7_8.6.x86_64 (base)\n               Not found\nError:

PLAY RECAP ************************************************************************************************************************
waldevprodcen02            : ok=8    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

========================================================================================================================================

Centos URL:



Thanks,
Snehal



































Dick Visser

unread,
Jun 24, 2020, 11:04:30 PM6/24/20
to ansible...@googlegroups.com

This sounds like the repo file template isn't constructed properly. 

Did you compare the resulting repo file with one that you know works on another server?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/181f383d-7601-405a-9f20-d740411b55a3o%40googlegroups.com.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

Snehal Mehar

unread,
Jun 25, 2020, 3:06:02 AM6/25/20
to ansible...@googlegroups.com, dick....@geant.org
Thank you Dick for your reply. I was able to solve it when I added extra repo configuration in the centos.repo.j2 file. See below...

==================================================================================================================

[base]
name = CentOS-Base
baseurl = http://mirror.centos.org/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/os/{{ ansible_architecture }}

gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
gpgcheck = 1
enabled = 1

[updates]
name = CentOS-Updates

baseurl = http://mirror.centos.org/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/updates/{{ ansible_architecture }}
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
gpgcheck = 1
enabled = 1

[extras]
name = CentOS-Extras
baseurl = http://mirror.centos.org/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/extras/{{ ansible_architecture }}

gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
gpgcheck = 1
enabled = 1

[centosplus]
name = CentOS-Plus
baseurl = http://mirror.centos.org/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/centosplus/{{ ansible_architecture }}

gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
gpgcheck = 1
enabled = 1

Thanks,
Snehal



--
Regards,
Snehal Mehar,
 


Reply all
Reply to author
Forward
0 new messages