- hosts: group-zabbix
ignore_errors: True
tasks:
- name: 统计进程
shell: ps -ef | grep zabbix4.4 |wc -l
register: check_value
- name: 输出信息
shell: echo "进程存在"
when: check_value.stdout|int > 0
本文介绍了一个使用Ansible脚本来检查Zabbix进程是否运行的任务配置。通过shell模块执行命令,统计运行中的Zabbix进程数量,并根据结果输出相应的信息。
- hosts: group-zabbix
ignore_errors: True
tasks:
- name: 统计进程
shell: ps -ef | grep zabbix4.4 |wc -l
register: check_value
- name: 输出信息
shell: echo "进程存在"
when: check_value.stdout|int > 0
735
1784