Created
July 7, 2020 08:47
-
-
Save a-nldisr/e6fad5df9d31c7f1b8a097e2a9d700db to your computer and use it in GitHub Desktop.
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
- name: 'Verify if directories already exists' | |
stat: | |
path: "{{ playbook_dir }}/roles/{{ new_role_name }}/{{item.dest}}" | |
register: folder_stats | |
loop: | |
- { dest: "tasks" } | |
- { dest: "templates" } | |
- { dest: "defaults" } | |
- { dest: "handlers" } | |
# Could not find a shorter way to query the path | |
- name: 'Create top directory level structures' | |
file: | |
path: "{{ item.invocation.module_args.path }}" | |
state: directory | |
mode: '0755' | |
when: item.stat.exists == false | |
with_items: | |
- "{{ folder_stats.results }}" | |
tags: create |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment