One loop over multiple Ansible tasks

0 votes
I've created an Ansible playbook that creates a cloud instance and then installs some programs on the instance. I want to run this playbook multiple times (without using a bash script). What can I do as with_items seemed like it would be a good approach but too bad we cant use this anymore.
Jul 23, 2018 in Ansible by Hannah
• 14,080 points
559 views

1 answer to this question.

0 votes

With_items has unfortunately stopped but it’s coming up in its new versions.

You could try to work with the v2 branch from github.

What you can do with 1.9.1 is to move your tasks into a role and reference this role multiple times in your playbook.

answered Jul 23, 2018 by Kalgi
• 37,430 points

Related Questions In Ansible

0 votes
1 answer

Using multiple config files using same template in a role in ansible

Go through this include_role module: tasks: - ...READ MORE

answered Jun 5, 2018 in Ansible by DareDev
• 6,810 points
349 views
0 votes
1 answer

Running ansible command on a single server when it is deployed to multiple servers

You can try the run_once attribute: Example from ...READ MORE

answered Jun 13, 2018 in Ansible by DareDev
• 6,810 points
125 views
0 votes
1 answer

ansible playbook: using multiple variables in loops

Use an indexed hostname, and then define ...READ MORE

answered Jul 16, 2018 in Ansible by DareDev
• 6,810 points
3,601 views
0 votes
1 answer

stopping different hosts from reading the same value when usign ansible in loop

Try using this. Create a new directory ...READ MORE

answered Jul 27, 2018 in Ansible by DareDev
• 6,810 points
29 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Ansible iterate over hash with condition

Your when statement is wrong. you either split ...READ MORE

answered Jul 23, 2018 in Ansible by Kalgi
• 37,430 points
152 views