Forum Discussion
Ansible Dynamic node tasks
Looping over Parallel Sets of Data
Suppose you have the following variable data was loaded in via somewhere:
alpha: [ 'a', 'b', 'c', 'd' ] numbers: [ 1, 2, 3, 4 ] And you want the set of ‘(a, 1)’ and ‘(b, 2)’ and so on. Use ‘with_together’ to get this:
tasks: - debug: msg="{{ item.0 }} and {{ item.1 }}" with_together: - "{{alpha}}" - "{{numbers}}"
We can use the above loop to fulfill our requirement where to create/use multiple nodes in respective of LB or where to use multiple items.
Reference - http://ansible-docs.readthedocs.io/zh/stable-2.0/rst/playbooks_loops.html
Does anyone have a simple example to test with or use as a template?
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com