Ansible 查询主机是否有360进程

25 阅读1分钟

Ansible 查询主机是否有360进程

编辑主机配置文件

vi hosts

ip ansible_ssh_user=用户 ansible_ssh_pass='密码'

ip ansible_ssh_user=用户 ansible_ssh_pass='密码'

#hosts所有主机都执行ps -ef|grep -v grep|grep 360 safe > ps360命令

ansible -i ~/hosts all -m shell -a 'ps -ef|grep -v grep|grep 360safe' >ps360

image.png