Hi,

I am facing the below issue while updating CentOS Linux release 7.9.2009 
(Core)

➜  ~ cat /Users/kaushal/hosts
[yum]
192.168.0.112 ansible_ssh_user=root
➜  ~ cat pkg_update.yml
---
- hosts: yum
  become: yes
  become_user: root
  tasks:
  - name: Update all installed packages using YUM module
    yum:
      name: '*'
      state: latest
      update_cache: yes
      update_only: yes
    register: yum_update_status

  - name: Remove packages not needed anymore
    yum:
      autoremove: yes

  - name: Reboot when packages were updated
    reboot:
    when: yum_update_status.changed

  - name: checking updates
    yum:
       security: yes
       state: latest
    check_mode: yes
    register: yum_output
    become: true

  - name: show that yum output
    debug:
       var: yum_output

➜  ~

$ansible-playbook -i /Users/kaushal/hosts pkg_update.yml

PLAY [yum] 
***************************************************************************************************************************************************

TASK [Gathering Facts] 
***************************************************************************************************************************************
ok: [192.168.0.112]

TASK [Update all installed packages using YUM module] 
********************************************************************************************************
fatal: [192.168.0.112]: FAILED! => {"changed": true, "changes": 
{"installed": [], "updated": [["kernel", "3.10.0-1160.76.1.el7.x86_64 from 
updates"], ["mysql-community-common", "8.0.30-1.el7.x86_64 from 
mysql80-community"], ["kernel-tools-libs", "3.10.0-1160.76.1.el7.x86_64 
from updates"], ["mysql-community-client", "8.0.30-1.el7.x86_64 from 
mysql80-community"], ["java-1.8.0-openjdk-headless", 
"1:1.8.0.342.b07-1.el7_9.x86_64 from updates"], ["python-perf", 
"3.10.0-1160.76.1.el7.x86_64 from updates"], 
["mysql-community-client-plugins", "8.0.30-1.el7.x86_64 from 
mysql80-community"], ["mysql-community-libs", "8.0.30-1.el7.x86_64 from 
mysql80-community"], ["microcode_ctl", "2:2.1-73.14.el7_9.x86_64 from 
updates"], ["mysql-community-libs-compat", "8.0.30-1.el7.x86_64 from 
mysql80-community"], ["kernel-tools", "3.10.0-1160.76.1.el7.x86_64 from 
updates"], ["java-1.8.0-openjdk", "1:1.8.0.342.b07-1.el7_9.x86_64 from 
updates"]]}, "msg": "warning: 
/var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-common-8.0.30-1.el7.x86_64.rpm:
 
Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY\n\n\nGPG key 
retrieval failed: [Errno 14] curl#37 - \"Couldn't open file 
/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022\"\n", "rc": 1, "results": ["Loaded 
plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * 
base: centos.excellmedia.net\n * epel: mirror.sjtu.edu.cn\n * extras: 
centos.excellmedia.net\n * updates: centos.excellmedia.net\nResolving 
Dependencies\n--> Running transaction check\n---> Package 
java-1.8.0-openjdk.x86_64 1:1.8.0.332.b09-1.el7_9 will be updated\n---> 
Package java-1.8.0-openjdk.x86_64 1:1.8.0.342.b07-1.el7_9 will be an 
update\n---> Package java-1.8.0-openjdk-headless.x86_64 
1:1.8.0.332.b09-1.el7_9 will be updated\n---> Package 
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.342.b07-1.el7_9 will be an 
update\n---> Package kernel.x86_64 0:3.10.0-1160.76.1.el7 will be 
installed\n---> Package kernel-tools.x86_64 0:3.10.0-1160.71.1.el7 will be 
updated\n---> Package kernel-tools.x86_64 0:3.10.0-1160.76.1.el7 will be an 
update\n---> Package kernel-tools-libs.x86_64 0:3.10.0-1160.71.1.el7 will 
be updated\n---> Package kernel-tools-libs.x86_64 0:3.10.0-1160.76.1.el7 
will be an update\n---> Package microcode_ctl.x86_64 2:2.1-73.13.el7_9 will 
be updated\n---> Package microcode_ctl.x86_64 2:2.1-73.14.el7_9 will be an 
update\n---> Package mysql-community-client.x86_64 0:8.0.29-1.el7 will be 
updated\n---> Package mysql-community-client.x86_64 0:8.0.30-1.el7 will be 
an update\n---> Package mysql-community-client-plugins.x86_64 
0:8.0.29-1.el7 will be updated\n---> Package 
mysql-community-client-plugins.x86_64 0:8.0.30-1.el7 will be an 
update\n---> Package mysql-community-common.x86_64 0:8.0.29-1.el7 will be 
updated\n---> Package mysql-community-common.x86_64 0:8.0.30-1.el7 will be 
an update\n---> Package mysql-community-libs.x86_64 0:8.0.29-1.el7 will be 
updated\n---> Package mysql-community-libs.x86_64 0:8.0.30-1.el7 will be an 
update\n---> Package mysql-community-libs-compat.x86_64 0:8.0.29-1.el7 will 
be updated\n---> Package mysql-community-libs-compat.x86_64 0:8.0.30-1.el7 
will be an update\n---> Package python-perf.x86_64 0:3.10.0-1160.71.1.el7 
will be updated\n---> Package python-perf.x86_64 0:3.10.0-1160.76.1.el7 
will be an update\n--> Finished Dependency Resolution\n--> Running 
transaction check\n---> Package kernel.x86_64 0:3.10.0-1160.42.2.el7 will 
be erased\n--> Finished Dependency Resolution\n\nDependencies 
Resolved\n\n================================================================================\n
 
Package                 Arch   Version                 Repository         
Size\n================================================================================\nInstalling:\n
 
kernel                  x86_64 3.10.0-1160.76.1.el7    updates           
 50 M\nUpdating:\n java-1.8.0-openjdk      x86_64 1:1.8.0.342.b07-1.el7_9 
updates           315 k\n java-1.8.0-openjdk-headless\n                     
    x86_64 1:1.8.0.342.b07-1.el7_9 updates            33 M\n kernel-tools   
         x86_64 3.10.0-1160.76.1.el7    updates           8.2 M\n 
kernel-tools-libs       x86_64 3.10.0-1160.76.1.el7    updates           
8.1 M\n microcode_ctl           x86_64 2:2.1-73.14.el7_9       updates     
      4.5 M\n mysql-community-client  x86_64 8.0.30-1.el7           
 mysql80-community  14 M\n mysql-community-client-plugins\n                 
        x86_64 8.0.30-1.el7            mysql80-community 2.5 M\n 
mysql-community-common  x86_64 8.0.30-1.el7            mysql80-community 
645 k\n mysql-community-libs    x86_64 8.0.30-1.el7           
 mysql80-community 1.5 M\n mysql-community-libs-compat\n                   
      x86_64 8.0.30-1.el7            mysql80-community 670 k\n python-perf 
            x86_64 3.10.0-1160.76.1.el7    updates           8.2 
M\nRemoving:\n kernel                  x86_64 3.10.0-1160.42.2.el7   
 @updates           64 M\n\nTransaction 
Summary\n================================================================================\nInstall
 
  1 Package\nUpgrade  11 Packages\nRemove    1 Package\n\nTotal size: 132 
M\nDownloading packages:\nRetrieving key from 
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022\n"]}

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

➜  ~

Am i missing anything. Please guide.  Thanks in advance. 

Best Regards,

Kaushal

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/be68566a-707a-4119-8fab-a1404e449db6n%40googlegroups.com.

Reply via email to