首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是否有可能增加apt_repository模块的超时时间?

是否有可能增加apt_repository模块的超时时间?
EN

Stack Overflow用户
提问于 2019-11-19 16:59:27
回答 1查看 1.1K关注 0票数 0

我的剧本里有这样的内容:

代码语言:javascript
复制
- 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

但我得到了:

代码语言:javascript
复制
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>"}

发生这种情况是因为代理需要很长时间才能响应。这是因为我无法更改通过公司组策略应用的DNS设置。

我能以某种方式增加超时时间吗?

后续工作-解决方法

我把它用来解决这个问题:

代码语言:javascript
复制
  - 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

不过,这看起来有点像一个肮脏的黑客技巧。这是我的具体问题的解决方案吗?

EN

回答 1

Stack Overflow用户

发布于 2019-11-20 04:53:10

只需添加until/retries/delay和at就足够了。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58930106

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档