feat: Reorganizes some of the roles and renames some variables
This commit is contained in:
27
roles/load-template-vars/tasks/main.yml
Normal file
27
roles/load-template-vars/tasks/main.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
# Used internally to clone the template repo, if applicable and load it's
|
||||
# variables.
|
||||
#
|
||||
# NOTE: This expects that you've called prepare-template-facts first.
|
||||
|
||||
- name: Check if template path exists.
|
||||
ansible.builtin.stat:
|
||||
path: "{{ template_dir }}"
|
||||
register: template_dir_stat
|
||||
|
||||
- name: Ensure repo.
|
||||
ansible.builtin.git:
|
||||
repo: "{{ template.repo.url }}"
|
||||
dest: "{{ template_dir }}"
|
||||
version: "{{ template.repo.version | default('main') }}"
|
||||
when: template.repo.url is defined and not template_dir_stat.stat.exists
|
||||
|
||||
- name: Check for repo vars directory.
|
||||
ansible.builtin.stat:
|
||||
path: "{{ template_vars_path }}"
|
||||
register: repo_vars
|
||||
|
||||
- name: Load repo vars if available.
|
||||
ansible.builtin.include_vars:
|
||||
dir: "{{ template_vars_path }}"
|
||||
when: repo_vars.stat.isdir is defined
|
||||
Reference in New Issue
Block a user