From the course: Red Hat Certified Engineer (EX294) Cert Prep: 2 Using Ansible Playbooks
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Looping methods in Ansible
From the course: Red Hat Certified Engineer (EX294) Cert Prep: 2 Using Ansible Playbooks
Looping methods in Ansible
- [Instructor] There are two different methods of looping through data in Ansible with underscore and loop. The original method use the with keyword followed by a lookup plugin. There are many different lookup plugins available. You can see a list by typing into a terminal Ansible dash doc space dash t space lookup space dash l for list and hit Enter. We can see that we have lookup plugins for CSV files, dictionaries, files which reads file contents, file glob which reads file names by pattern, file tree which shows a recursive directory list, items for a list of items, nested for nested data structures, sequence, vars and many others. To see the documentation for a certain lookup plugins such as the items plugin type in Q to quit and then type in Ansible dash doc space dash t space lookup space items and hit Enter. And this will show you the documentation for the items lookup plugin. Use with underscore items to loop…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.