@xavi_xsb
$ ansible web -i hosts -m apt -a "name=nginx state=present" -s
- hosts: web
sudo: True
tasks:
- name: install nginx
apt: name=nginx state=present
- name: "shutdown Debian flavored systems"
command: /sbin/shutdown -t now
when: ansible_os_family == "Debian"
- name: add users
user: name={{ item }} state=present groups=speakers
with_items:
- xavi
- ignasi
- josep
- hosts: web
vars:
owner: root
group: root
mode: 0644
tasks:
- copy: src=file.txt dest=/file.txt
owner={{ owner }}
group={{ group }}
mode={{ mode }}
roles/loadbalancer/
├── files
│ └── haproxy
├── handlers
│ └── main.yml
├── tasks
│ └── main.yml
└── templates
└── haproxy.cfg.j2
[web]
web1.example.com
web2.example.com
[db]
db.example.com
[smtp]
mailer.example.com
ansible/
├── hosts
├── roles
│ ├── loadbalancer
│ │ ├── files
│ │ │ └── haproxy
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ └── templates
│ │ └── haproxy.cfg.j2
│ └── web
│ ├── tasks
│ │ └── main.yml
│ └── templates
│ └── index.html.j2
└── site.yml