Loop: Plays in the future, items in the past
Welcome to another episode of Feature Spotlight. In today's post, we'll quickly cover the loop keyword being introduced in Ansible 2.5.
Everyone knows the with_* syntax in playbooks.
For example:
- name: Test that with_list works with a list
ping:
data: ''
with_list:
- 'Hello World'
- 'Olá Mundo'
In Ansible 2.5, we're introducing loop as a shorter, simpler keyword for playbooks.
Example:
- name: Test that loop works with a manual list
ping:
data: ''
loop:
- 'Hello World'
- 'Olá Mundo'
It's a very minute change, and can easily be overlooked when skimming a playbook! However, when writing many lines of tasks in a playbook, why not save some potential muscle fatigue?
Let's be real, even if a playbook accomplishes a whole lot in 10 lines, that's still ten lines!
All joking aside, we wanted to make things simpler. It's much easier to remember loop than with_items or with_list.
The question after this very well may be, "What happens to with_first_found or with_dict or .... etc, etc, etc?
Well the idea here is to abstract out some of the magic that with_* really is.
Example:
- name: Test that loop works with a list via the list Continue reading
The data center company expects to hit $5 billion in revenue in 2018.
The company's intent-based networking is doing quite well.
Both firms say they are trusted partners of U.S. suppliers and customers.
Oracle gains its AI-driven web application firewall and DDoS mitigation software.