[root@node01 ansible]# cat playbook.yml
- hosts: webservers
remote_user: root
tasks:
- name: test connection
ping:
- name: hostname
raw: hostname
- name: restart vsftpd
service: name=vsftpd state=restarted enabled=yes
- hosts: database
remote_user: root
tasks:
- name: "start redis"
service: name=redis state=started enabled=yes