本地Ubuntu服务器Ansible部署Apache报错:Failed to update apt cache
在本地Ubuntu服务器通过Ansible Playbook安装Apache2时遇到Apt缓存更新失败问题
尝试在本地Ubuntu服务器上通过Ansible Playbook安装基础apache2,运行Playbook时出现以下错误:
PLAY [Ansible Playbook to Install and Setup Apache on Ubuntu] ******************************************************************************************************************* TASK [Gathering Facts] ********************************************************************************************************************************************************** ok: [localhost] TASK [Install latest version of Apache] ***************************************************************************************************************************************** fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to update apt cache: unknown reason"} PLAY RECAP ********************************************************************************************************************************************************************** localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Playbook中已将hosts变量设置为localhost,尝试了以下两个命令均无法解决问题:
ansible-playbook playbook.yml --connection=localansible-playbook playbook.yml
以下是详细的verbose报错信息:
fatal: [localhost]: FAILED! => { "changed": false, "invocation": { "module_args": { "allow_change_held_packages": false, "allow_downgrade": false, "allow_unauthenticated": false, "autoclean": false, "autoremove": false, "cache_valid_time": 0, "clean": false, "deb": null, "default_release": null, "dpkg_options": "force-confdef,force-confold", "fail_on_autoremove": false, "force": false, "force_apt_get": false, "install_recommends": null, "lock_timeout": 60, "name": "apache2", "only_upgrade": false, "package": [ "apache2" ], "policy_rc_d": null, "purge": false, "state": "latest", "update_cache": true, "update_cache_retries": 5, "update_cache_retry_max_delay": 12, "upgrade": null } }, "msg": "Failed to update apt cache: unknown reason" }
内容的提问来源于stack exchange,提问作者deeztesternuts
相关产品推荐
相关产品推荐

