Multiple modules in a same task

37 views
Skip to first unread message

Suporter

unread,
Apr 21, 2017, 4:21:55 AM4/21/17
to Ansible Project
Is it possible to have multiple modules in same task? for example : if i want to copy a file and extract it cant i use copy and unzip in same task? should i create separate tasks for each module?

Brian Coca

unread,
Apr 21, 2017, 3:15:16 PM4/21/17
to Ansible Project
Each action is a task, modules provide actions. It would be the same
as saying 'can i have multiple tasks per task'.

----------
Brian Coca

J Hawkesworth

unread,
Apr 21, 2017, 3:23:09 PM4/21/17
to Ansible Project
Yes, each module usage is a separate task. You can use roles to group together tasks so that you can reuse them. Have a look on ansible galaxy - there are lots of roles there to install and configure things.

Once you have tried using and making roles, it would be worth looking at blocks as I think they can be used to group together related tasks.

Jon

Reply all
Reply to author
Forward
0 new messages