Ansible playbook挂在单个主机上
剧本经过简化,便于快速理解Ansible playbook挂在单个主机上,ansible,Ansible,剧本经过简化,便于快速理解 --- - hosts: web_host remote_user: someuser connection: ssh ignore_errors: yes vars: date: "{{ lookup('pipe', 'date +%Y%m%d) }}" gather_facts: no # gather_subset: "!all,!min" tasks: - name: 1 | Collect all remote
---
- hosts: web_host
remote_user: someuser
connection: ssh
ignore_errors: yes
vars:
date: "{{ lookup('pipe', 'date +%Y%m%d) }}"
gather_facts: no
# gather_subset: "!all,!min"
tasks:
- name: 1 | Collect all remote servers statistics
script: /home/raman/ansible/playbooks/monitoring/mon_sys.bash
register: CPU_Mem_Service
tags:
- CPU_Mem_Service_TAG
args:
executable: /bin/bash
ignore_errors: yes
所有远程主机都在RHEL6.10上
playbook中使用的脚本具有df-h
命令
这本剧本运行良好,直到它没有
有时此剧本挂在一个远程主机上。这个“一”远程主机是随机的。检查后,通过亲自登录挂起的远程主机,我发现df
命令挂起在该主机上。由于NFS装载过时/失效
有没有办法让ansible playbook跳过并继续前进,而不是无限期地停留在同一主机上
有什么建议吗?使用异步和轮询
异步任务将一直运行,直到根据其异步值完成、失败或超时为止
当poll为正值(如果未指定,则默认值为15)时,playbook仍会阻止任务,直到任务完成、失败或超时
当poll为0时,Ansible将启动任务并立即转到下一个任务,而无需等待结果。最终可能是您的朋友。谢谢您的想法。这里是async的问题[即使我用其他东西更改了脚本模块,因为它不适用于async]。Playbook只是无限期地挂起。问:如果我把async:60放在这个任务上。它会在60秒后通过卡住/挂起的主机吗?