O'Reilly logo

Learning Ansible by Ramesh Raithatha, Madhurranjan Mohaan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with loops

Have you ever wondered how life would be if you had to install several packages on your remote systems manually? We saw how Ansible helped us in such a situation by automating the package installation. However, it would be still a nightmare if you have to write the same task multiple times with different package names. To overcome such situations and to make your life easier, Ansible provides you with loops.

Standard loops

Using standard loops, you can pass a list of packages to install and Ansible will run that task for all packages listed. Confused? Let's now go through an example playbook.

Standard loops

In the preceding playbook, Ansible will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required