常见的操作方式
-C --check #只检测可能发生的改变,但不会真正执行操作
--list-hosts #列出运行主机的任务
--list-tasks #列出task
--limit #只针主机列表中的主机执行
-v -vv -vvv #显示过程
notif&handlers 功能 :
---
- hosts: ts_host
remote_user: root
tasks:
- name: config nginx
copy: src=/root/comfig.txt dest=/etc/nginx/nginx.conf
notif:
- restart nginx
- check nginx process
handlers:
- name: restart nginx
service: name=nginx state=restart
- name: check nginx
service: killall -0 nginx > /tmp/nginx.log
tasks 功能: