Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (2.3k points)
So, i've been working with Ansible and have created a playbook that helps me create a cloud instance and then installs few programs on it.

What i want to do is to run this playbook multiple times without using a bash script. How can I work with 'with_items' It seemed like it would be a good approach to my issue, but too bad we cant use this anymore.

2 Answers

0 votes
by (12.4k points)

Providing the example, you can take the reference:

- hosts: all

  gather_facts: false

  tasks: 

    - include: demo.yml some_var={{item}}

      with_items:

      - x

      - y

      - z

Interested in knowing more about DevOps tools? Check out: DevOps Training 

0 votes
by (6.9k points)
Well unfortunately 'With_items' has stopped working but don't worry a new version is coming up. Try working with the v2 branch from github. You can  move your tasks into a role and reference this particular role multiple times in you playbook with 1.9.1.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...