ansible-doc -l 查看所有模块
ansible-doc -s copy 查看模块文档
常用模块
1、 shell:
ansible webservers -m shell -a "which sh"
2、copy
ansible webservers -m copy -a "src=/etc/hosts dest=/tmp"
3、file: 管理文件和文件属性的
ansible webservers -m file -a "path=/tmp/hosts state=absent"
4、yum
ansible webservers -m yum -a "name=epel-release state=present"
5、service/systemd
ansible webservers -m systemd -a "name=nginx state=started enabled=yes"
6、unarchive:解压模块
7、debug
ansible-playbook 工具:
ansible-playbook -i /etc/ansible/hosts nginx.yaml