From 1ae281b078f7c215eb5d5703a4aa942b7803325d Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Tue, 26 Nov 2024 18:32:21 -0500 Subject: [PATCH] feat: Changes template_dir to template in setup-project --- roles/setup-project/defaults/main.yml | 2 +- roles/setup-project/tasks/main.yml | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/roles/setup-project/defaults/main.yml b/roles/setup-project/defaults/main.yml index c7d4592..5b3f56e 100644 --- a/roles/setup-project/defaults/main.yml +++ b/roles/setup-project/defaults/main.yml @@ -4,7 +4,7 @@ # path: "/path/to/template/dir # vars: "repo_vars" # repo: (optional if using a repo as a template) -template_dir: +template: path: "/path/to/template/dir" vars: "repo_vars" diff --git a/roles/setup-project/tasks/main.yml b/roles/setup-project/tasks/main.yml index da4c9ca..7133c7c 100644 --- a/roles/setup-project/tasks/main.yml +++ b/roles/setup-project/tasks/main.yml @@ -10,19 +10,19 @@ - name: Ensure repo. ansible.builtin.git: - repo: "{{ template_dir.repo.url }}" - dest: "{{ template_dir.path }}" - version: "{{ template_dir.repo.version | default('main') }}" - when: template_dir.repo.url is defined + repo: "{{ template.repo.url }}" + dest: "{{ template.path }}" + version: "{{ template.repo.version | default('main') }}" + when: template.repo.url is defined - name: Check for repo vars directory. ansible.builtin.stat: - path: "{{ template_dir.path }}/{{ template_dir.vars }}" + path: "{{ template.path }}/{{ template_dir.vars }}" register: repo_vars - name: Load repo vars if available. ansible.builtin.include_vars: - dir: "{{ template_dir.path }}/{{ template_dir.vars }}" + dir: "{{ template.path }}/{{ template_dir.vars }}" when: repo_vars.stat.isdir is defined - name: Debug on_setup. @@ -36,7 +36,7 @@ ansible.builtin.include_tasks: file: "copy_if_not_exists.yml" vars: - source: "{{ template_dir.path }}/{{ item }}" - destination: "{{ output_dir }}/{{ item }}" - mode: '0600' - with_items: "{{ copy_on_setup }}" + source: "{{ template.path }}/{{ item.src | default(item) }}" + destination: "{{ output_dir }}/{{ item.dest | default(item) }}" + mode: "{{ item.mode | default('0600') }}" + loop: "{{ copy_on_setup }}"