ansible - Ansible playbook 任务 - 命令找不到 pid,但服务已正确启动
问题描述
我已经配置了一个剧本来安装、配置和启动 osquery 工具。playbook 执行时出现错误。“osqueryd 没有运行。没有找到 pidfile。”
完全错误
TASK [osquery-client : check agent status again] ********************************************************************************************************************
fatal: [13.57.34.71]: FAILED! => {"changed": true, "cmd": ["/usr/bin/osqueryctl", "status"], "delta": "0:00:00.021902", "end": "2019-10-16 19:19:50.523876", "msg": "non-zero return code", "rc": 7, "start": "2019-10-16 19:19:50.501974", "stderr": "", "stderr_lines": [], "stdout": "osqueryd is not running. no pidfile found.", "stdout_lines": ["osqueryd is not running. no pidfile found."]}
我的 task/main.yml 定义为:
- name: check agent status again
command: /usr/bin/osqueryctl status
ignore_errors: yes
pid文件位于这里
--pidfile=/var/run/osqueryd.pidfile
ansible 在错误的地方寻找 pid 吗?
解决方案
将此睡眠命令添加到任务中似乎有效
- name: check agent status again
command: /usr/bin/osqueryctl status
command: sleep 5
ignore_errors: yes
推荐阅读
- java - 如何检查字符串是否包含没有正则表达式的拉丁字母
- javascript - 我如何解决 Javascript Fetch 的问题
- javascript - 如何根据点条件动态启用/禁用系列工具提示
- reactjs - 来自 DRF 的图像未在反应 js 中加载
- git - 为什么window git Bash中只有两个PS命令?如图所示
- python - 使用 Python SDK 和 Azure Functions 将元数据添加到 Azure Blob
- mongodb - Mongoose - 子文档数组问题
- java - IntelliJ 中的 mvn spring-boot:run 和“run”有什么区别
- javascript - 如何访问对象内的图像链接并使用反应组件显示它
- azure-data-explorer - Kusto CSL 首字母缩略词的含义