Skip to content

Instantly share code, notes, and snippets.

@ciiqr
Created February 10, 2019 04:43
Show Gist options
  • Save ciiqr/debba3bb269997507cba718f79617bc9 to your computer and use it in GitHub Desktop.
Save ciiqr/debba3bb269997507cba718f79617bc9 to your computer and use it in GitHub Desktop.
Ansible: Optional role include
- name: Check for optional role
stat:
path: '{{ item }}/optional'
register: role_exists
loop: "{{ lookup('config', 'DEFAULT_ROLES_PATH') }}"
- include_role:
name: optional
when: true in role_exists.results | map(attribute='stat.exists')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment