【发布时间】:2022-01-07 03:13:26
【问题描述】:
我正在通过 playbook 运行 shell 脚本
- name: Get status of Filebeat
shell: sh /path/get_status.sh "status"
when: action == "status"
我的 shell 脚本是 get_status.sh
SERVICE="filebeat"
if pgrep -x "$SERVICE" >/dev/null
then
echo "$SERVICE is running"
else
echo "$SERVICE is stopped"
我希望这个 shell 脚本的 echo 语句出现在 ansible 输出上,我该怎么做?
【问题讨论】: