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