Created
May 26, 2021 20:05
-
-
Save adamchainz/cb9bfc51160e30d803b08a7dbee9dbec to your computer and use it in GitHub Desktop.
ansible loop with persistence of result from last
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- debug: | |
msg: '{{ last|default("") }} -> {{ item }}' | |
- set_fact: | |
last: '{{ item }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
connection: local | |
gather_facts: no | |
vars: | |
mylist: | |
- a | |
- b | |
- c | |
tasks: | |
- include_tasks: inner.yml | |
loop: '{{ mylist }}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment