what is mean by play and what's the diffrence plays vs tasks, example please?

14 views
Skip to first unread message

Chandramohan Reddy

unread,
Dec 18, 2017, 9:42:49 PM12/18/17
to Ansible Project
Hi All,

Can you please explain me what is play and play vs tasks .

Could you give any example for play.

Thanks & Regards
ChandraMohan

Brian Coca

unread,
Dec 19, 2017, 3:54:30 PM12/19/17
to Ansible Project
tasks are actions to be performed, a play is a mapping between a list
of hosts and list of tasks.

Normally you can recognize a play as it is the only thing that has a
`hosts:` keyword, tasks always belong inside a play, normally under
the tasks: keyword.

- name: this is a play
hosts: all
tasks:
- name: this is a task
debug: msg=this is a task

Tasks can be put in more places other than the tasks keyword, but they
always need to be inside a play to be executed. i.e they can be in a
role, but the role must be in a play.


--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages