Skip to content

Instantly share code, notes, and snippets.

@kylejeske
Last active April 24, 2019 17:47
Show Gist options
  • Save kylejeske/2b586e31c0b31607e3780803213d5844 to your computer and use it in GitHub Desktop.
Save kylejeske/2b586e31c0b31607e3780803213d5844 to your computer and use it in GitHub Desktop.
Ansible Reference Items by Index Position
hosts: all
vars:
file_path_1: /usr/bin
file_path_2: /example
file_path_3: /opt
tasks:
- name: example task
file:
path: "{{ item.0 }}/{{ item.1 }}"
state: present
with items:
- [ "{{ file_path_1 }}/{{ file_path_2 }}"
- [ "{{ file_path_3 }}/{{ file_path_2 }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment