mysql-server를 설치해야 하며 선택한 방법은 프로세스를 단순화하는 Ansible을 사용하는 것입니다. 그런데 설치 중에 이 문제를 발견했지만 디버깅할 수 없었습니다. 내 YAML 파일은 다음과 같습니다.
- name: Install mysql-server
dnf:
name: mysql-server
state: present
그러나 이것은 이상한 오류를 발생시킵니다.
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "warning: /var/cache/dnf/mysql56-community-e7223972839acae4/packages/mysql-community-client-5.6.51-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Traceback (most recent call last):
File \"/home/aunzaidi/.ansible/tmp/ansible-tmp-1637891029.2032368-4612-101264433776442/AnsiballZ_dnf.py\", line 100, in <module>
_ansiballz_main()
File \"/home/aunzaidi/.ansible/tmp/ansible-tmp-1637891029.2032368-4612-101264433776442/AnsiballZ_dnf.py\", line 92, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File \"/home/aunzaidi/.ansible/tmp/ansible-tmp-1637891029.2032368-4612-101264433776442/AnsiballZ_dnf.py\", line 41, in invoke_module
run_name='__main__', alter_sys=True)
File \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module
fname, loader, pkg_name)
File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code
exec code in run_globals
File \"/tmp/ansible_dnf_payload_p9Z365/ansible_dnf_payload.zip/ansible/modules/dnf.py\", line 1363, in <module>
File \"/tmp/ansible_dnf_payload_p9Z365/ansible_dnf_payload.zip/ansible/modules/dnf.py\", line 1352, in main
File \"/tmp/ansible_dnf_payload_p9Z365/ansible_dnf_payload.zip/ansible/modules/dnf.py\", line 1326, in run
File \"/tmp/ansible_dnf_payload_p9Z365/ansible_dnf_payload.zip/ansible/modules/dnf.py\", line 1230, in ensure
File \"/usr/lib/python2.7/site-packages/dnf/base.py\", line 2275, in _get_key_for_package
keys = dnf.crypto.retrieve(keyurl, repo)
File \"/usr/lib/python2.7/site-packages/dnf/crypto.py\", line 176, in retrieve
with dnf.util._urlopen(keyurl, repo=repo) as handle:
File \"/usr/lib/python2.7/site-packages/dnf/util.py\", line 130, in _urlopen
raise IOError(str(e))
IOError: Cannot download file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql: All mirrors were tried
", "module_stdout": "", "msg": "MODULE FAILURE
See stdout/stderr for the exact error", "rc": 1}
이와 관련된 결과나 포럼을 찾을 수 없습니다. 이는 간단해야 합니다. "-vvvvv"를 사용하여 Ansible 명령을 실행해도 다음 오류가 발생합니다.ansible-playbook -vvvvv ~/ansible/playbooks/starfish.yml
TASK [Install mysql-server] ******************************************************************************************************************************************************************
task path: /home/aunzaidi/ansible/playbooks/starfish.yml:35
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: aunzaidi
<localhost> EXEC /bin/sh -c 'echo ~aunzaidi && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/aunzaidi/.ansible/tmp `"&& mkdir "` echo /home/aunzaidi/.ansible/tmp/ansible-tmp-1637891456.166621-4897-257063194144455 `" && echo ansible-tmp-1637891456.166621-4897-257063194144455="` echo /home/aunzaidi/.ansible/tmp/ansible-tmp-1637891456.166621-4897-257063194144455 `" ) && sleep 0'
Using module file /usr/local/lib/python3.6/site-packages/ansible/modules/dnf.py
<localhost> PUT /home/aunzaidi/.ansible/tmp/ansible-local-4695ow_qhed0/tmp4jtykhs2 TO /home/aunzaidi/.ansible/tmp/ansible-tmp-1637891456.166621-4897-257063194144455/AnsiballZ_dnf.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/aunzaidi/.ansible/tmp/ansible-tmp-1637891456.166621-4897-257063194144455/ /home/aunzaidi/.ansible/tmp/ansible-tmp-1637891456.166621-4897-257063194144455/AnsiballZ_dnf.py && sleep 0'
<localhost> EXEC /bin/sh -c 'sudo -H -S -n -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-kgdvjtjhvcvmedzecrzshnfzzpgijvwy ; /usr/bin/python /home/aunzaidi/.ansible/tmp/ansible-tmp-1637891456.166621-4897-257063194144455/AnsiballZ_dnf.py'"'"' && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/aunzaidi/.ansible/tmp/ansible-tmp-1637891456.166621-4897-257063194144455/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "warning: /var/cache/dnf/mysql56-community-e7223972839acae4/packages/mysql-community-client-5.6.51-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY\nTraceback (most recent call last):\n File \"/home/aunzaidi/.ansible/tmp/ansible-tmp-1637891456.166621-4897-257063194144455/AnsiballZ_dnf.py\", line 100, in <module>\n _ansiballz_main()\n File \"/home/aunzaidi/.ansible/tmp/ansible-tmp-1637891456.166621-4897-257063194144455/AnsiballZ_dnf.py\", line 92, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/aunzaidi/.ansible/tmp/ansible-tmp-1637891456.166621-4897-257063194144455/AnsiballZ_dnf.py\", line 41, in invoke_module\n run_name='__main__', alter_sys=True)\n File \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module\n fname, loader, pkg_name)\n File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/tmp/ansible_dnf_payload_nxJSO1/ansible_dnf_payload.zip/ansible/modules/dnf.py\", line 1363, in <module>\n File \"/tmp/ansible_dnf_payload_nxJSO1/ansible_dnf_payload.zip/ansible/modules/dnf.py\", line 1352, in main\n File \"/tmp/ansible_dnf_payload_nxJSO1/ansible_dnf_payload.zip/ansible/modules/dnf.py\", line 1326, in run\n File \"/tmp/ansible_dnf_payload_nxJSO1/ansible_dnf_payload.zip/ansible/modules/dnf.py\", line 1230, in ensure\n File \"/usr/lib/python2.7/site-packages/dnf/base.py\", line 2275, in _get_key_for_package\n keys = dnf.crypto.retrieve(keyurl, repo)\n File \"/usr/lib/python2.7/site-packages/dnf/crypto.py\", line 176, in retrieve\n with dnf.util._urlopen(keyurl, repo=repo) as handle:\n File \"/usr/lib/python2.7/site-packages/dnf/util.py\", line 130, in _urlopen\n raise IOError(str(e))\nIOError: Empty mirrorlist and no basepath specified!\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
필요할 경우 전체 YAML "starfish.yml" 파일도 공유하겠습니다. 불가사리.yml. 어떤 도움이라도 대단히 감사하겠습니다.
답변1
패키지 관리자를 dnf에서 yum으로 변경해야만 이 문제를 해결할 수 있었습니다. CentOS 7.9에서 이전에 동일한 스크립트를 사용했기 때문에 이것이 왜 문제를 일으키는지 잘 모르겠습니다. 어쨌든 다음 코드를 구현하여 변경했습니다.
- name: Install mysql-server
yum:
name: mysql-server
state: present