Created
May 26, 2021 19:54
-
-
Save adamchainz/6e004731b5cbea0337e673d4d45c81bf to your computer and use it in GitHub Desktop.
ansible example getting item from previous iteration of loop
This file contains hidden or 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: | |
- debug: | |
msg: '{{ ansible_loop.previtem|default("") }}{{ item }}' | |
loop: '{{ mylist }}' | |
loop_control: | |
extended: yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment