--- # 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 tags: - always - name: Debug template variable. ansible.builtin.debug: var: template tags: - debug - never - 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 tags: - always - name: Check for repo vars directory. ansible.builtin.stat: path: "{{ template_vars_path }}" register: repo_vars tags: - always - name: Debug template vars path. ansible.builtin.debug: var: template_vars_path tags: - debug - never - name: Load repo vars if available. ansible.builtin.include_vars: dir: "{{ template_vars_path }}" when: repo_vars.stat.isdir is defined tags: - always