一、shell 模块(调用/bin/bash)
例子: -name: “update war”
shell: “echo “abc”“
二、file 模块
例子:- name “mkdir file”
file: `path=/root/foo.txt state=touch mode=0755 owner=foo group=foo`
三、copy模块
例子: - name: “copy file”
copy: `remote_src=no src=role/testbox/files/foo.sh dest=/root/foo.sh mode=0644 force=yes`
四、stat模块
例子:-name “check foo.sh”
stat: `path=/root/foo.sh`
register: script_stat
五、debug模块
例子: - debug: msg=foo.sh exists
when: script_stat.exists
六、command(不能调用/bin/bash)
七、template模块
例子: - name: “write the nginx config file”
template: src=roles/testbox/templates/nginx.con.j2 dest=/etc/nginx/nginx.con
八、packaging模块
例子: - name: enusure nginx is at the latest version
yum: pkg=nginx state=latest. (centos,rehat)
例子: - name: enusure nginx is at the latest version
yum: pkg=nginx state=latest. (Debian,Ubuntu)
九、service模块
例子:- name: start nginx service
service: name=nginx state=started