示例1:创建用户的Playbook
--- - name: create user hosts: openstack gather_facts: false tasks: - name: create {{ item }} user: name="{{ item }}" with_items: - alex2 - vincen2
示例2:创建用户的Playbook
--- - hosts: openstack vars: - user: "alex" - user: "vincen" tasks: - name: create {{ user }} user: name="{{ user }}"
示例3:设置nginx服务为启动状态
root@ubuntu:~/playbooks# cat nginx_service.yml --- - hosts: openstack user: root gather_facts: false tasks: - name: started nginx service: name=nginx state=started
示例4: 安装nginx