Skip to content

Instantly share code, notes, and snippets.

@eagleusb
Created November 22, 2016 12:47
Show Gist options
  • Save eagleusb/c3b0a6584e4545fc512c2f492db7d601 to your computer and use it in GitHub Desktop.
Save eagleusb/c3b0a6584e4545fc512c2f492db7d601 to your computer and use it in GitHub Desktop.
Ansible template loop snippet
- name: Copying the templated jinja2 files
template:
src: {{item}}
dest: {{RUN_TIME}}/{{ item | regex_replace(role_path+'/templates','') | regex_replace('\.j2', '') }}
with_items:
- "{{ lookup('pipe','find {{role_path}}/templates -type f').split('\n') }}"
- name: create x template
template:
src: {{ item }}
dest: /tmp/{{ item | basename | regex_replace('\.j2','') }}
with_fileglob:
- ../templates/*.j2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment