Ansible 是否可以增加apt_存储库模块的超时?
我的剧本里有这样的内容:Ansible 是否可以增加apt_存储库模块的超时?,ansible,Ansible,我的剧本里有这样的内容: - name: Add Glusterfs APT Repository become: yes become_method: sudo environment: http_proxy: http://192.168.42.250:3128/ https_proxy: http://192.168.42.250:3128/ apt_repository: repo: ppa:gluster/gluste
- name: Add Glusterfs APT Repository
become: yes
become_method: sudo
environment:
http_proxy: http://192.168.42.250:3128/
https_proxy: http://192.168.42.250:3128/
apt_repository:
repo: ppa:gluster/glusterfs-7
state: present
但我得到:
fatal: [192.168.42.105]: FAILED! => {"changed": false, "msg": "failed to fetch PPA information, error was: Request failed: <urlopen error timed out>"}
fatal: [192.168.42.103]: FAILED! => {"changed": false, "msg": "failed to fetch PPA information, error was: Request failed: <urlopen error timed out>"}
fatal: [192.168.42.102]: FAILED! => {"changed": false, "msg": "failed to fetch PPA information, error was: Request failed: <urlopen error timed out>"}
fatal: [192.168.42.104]: FAILED! => {"changed": false, "msg": "failed to fetch PPA information, error was: Request failed: <urlopen error timed out>"}
fatal: [192.168.42.107]: FAILED! => {"changed": false, "msg": "failed to fetch PPA information, error was: Request failed: <urlopen error timed out>"}
fatal: [192.168.42.101]: FAILED! => {"changed": false, "msg": "failed to fetch PPA information, error was: Request failed: <urlopen error timed out>"}
fatal: [192.168.42.106]: FAILED! => {"changed": false, "msg": "failed to fetch PPA information, error was: Request failed: <urlopen error timed out>"}
不过,这看起来有点像一个肮脏的黑客。这就是我的特定问题的解决方案吗?只需添加until/retries/delay和at就足够了。如果任务本身在超时时失败,那么它只会一次又一次地失败。它可能会修复间歇性故障,但如果服务器或代理速度较慢,则无法修复。
- name: Receive Glusterfs key
become: yes
become_method: sudo
environment:
http_proxy: http://192.168.42.250:3128/
https_proxy: http://192.168.42.250:3128/
command: apt-key adv --keyserver keyserver.ubuntu.com --keyserver-options http-proxy=http://192.168.42.250:3128/ --recv-keys f7c73fcc930ac9f83b387a5613e01b7b3fe869a9
- name: Add Glusterfs APT Repository
become: yes
become_method: sudo
apt_repository:
repo: deb http://ppa.launchpad.net/gluster/glusterfs-7/ubuntu xenial main
state: present
- name: Add Glusterfs APT Repository (source)
become: yes
become_method: sudo
apt_repository:
repo: deb-src http://ppa.launchpad.net/gluster/glusterfs-7/ubuntu xenial main
state: present