I am trying to install a package in linux using yum .. but it is failing as it is asking for a y/n option.
---
- hosts: dbserver
become: yes
vars_prompt:
- name: input_an_option
prompt: "Is this ok [y/d/N]"
tasks:
- debug:
msg: option selected is {{ input_an_option }}
- name: Install mysql
command: yum -y install mysql-community-server
[ansible@node1 udemy_ansible]$ ansible-playbook playbooks/database.yaml
Is this ok [y/d/N]:
PLAY [dbserver] ********************************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [
node5.example.com]
TASK [debug] ***********************************************************************************************************************************************************
ok: [
node5.example.com] => {
"msg": "option selected is "
}
TASK [Install mysql] ***************************************************************************************************************************************************
[WARNING]: Consider using the yum module rather than running 'yum'. If you need to use command because yum is insufficient you can add 'warn: false' to this command
task or set 'command_warnings=False' in ansible.cfg to get rid of this message.
fatal: [
node5.example.com]: FAILED! => {"changed": true, "cmd": ["yum", "-y", "install", "mysql-community-server"], "delta": "0:00:03.873598", "end": "2022-02-09 02:47:52.812896", "msg": "non-zero return code", "rc": 1, "start": "2022-02-09 02:47:48.939298", "stderr": "warning: /var/cache/yum/x86_64/7Server/mysql80-community/packages/mysql-community-client-plugins-8.0.28-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY\n\n\nThe GPG keys listed for the \"MySQL 8.0 Community Server\" repository are already installed but they are not correct for this package.\nCheck that the correct key URLs are configured for this repository.\n\n\n Failing package is: mysql-community-client-plugins-8.0.28-1.el7.x86_64\n GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql", "stderr_lines": ["warning: /var/cache/yum/x86_64/7Server/mysql80-community/packages/mysql-community-client-plugins-8.0.28-1.