feat: Changes template_dir to template in setup-project

This commit is contained in:
2024-11-26 18:32:21 -05:00
parent 916e62f6e6
commit 1ae281b078
2 changed files with 11 additions and 11 deletions

View File

@@ -4,7 +4,7 @@
# path: "/path/to/template/dir # path: "/path/to/template/dir
# vars: "repo_vars" # vars: "repo_vars"
# repo: (optional if using a repo as a template) # repo: (optional if using a repo as a template)
template_dir: template:
path: "/path/to/template/dir" path: "/path/to/template/dir"
vars: "repo_vars" vars: "repo_vars"

View File

@@ -10,19 +10,19 @@
- name: Ensure repo. - name: Ensure repo.
ansible.builtin.git: ansible.builtin.git:
repo: "{{ template_dir.repo.url }}" repo: "{{ template.repo.url }}"
dest: "{{ template_dir.path }}" dest: "{{ template.path }}"
version: "{{ template_dir.repo.version | default('main') }}" version: "{{ template.repo.version | default('main') }}"
when: template_dir.repo.url is defined when: template.repo.url is defined
- name: Check for repo vars directory. - name: Check for repo vars directory.
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ template_dir.path }}/{{ template_dir.vars }}" path: "{{ template.path }}/{{ template_dir.vars }}"
register: repo_vars register: repo_vars
- name: Load repo vars if available. - name: Load repo vars if available.
ansible.builtin.include_vars: ansible.builtin.include_vars:
dir: "{{ template_dir.path }}/{{ template_dir.vars }}" dir: "{{ template.path }}/{{ template_dir.vars }}"
when: repo_vars.stat.isdir is defined when: repo_vars.stat.isdir is defined
- name: Debug on_setup. - name: Debug on_setup.
@@ -36,7 +36,7 @@
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: "copy_if_not_exists.yml" file: "copy_if_not_exists.yml"
vars: vars:
source: "{{ template_dir.path }}/{{ item }}" source: "{{ template.path }}/{{ item.src | default(item) }}"
destination: "{{ output_dir }}/{{ item }}" destination: "{{ output_dir }}/{{ item.dest | default(item) }}"
mode: '0600' mode: "{{ item.mode | default('0600') }}"
with_items: "{{ copy_on_setup }}" loop: "{{ copy_on_setup }}"