diff --git a/defaults/main.yml b/defaults/main.yml index 5288816..ea63d8b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -36,11 +36,14 @@ build_dir_name: ".build" work_dir: "{{ lookup('env', 'PWD') }}" build_dir: "{{ work_dir }}/{{ build_dir_name }}" +# NOTE: These generally do not need changed, unless debugging or customizing files. +# Such as you want to add new definitions or customize the footer. config: - # NOTE: These generally do not need changed, unless debugging or customizing files. - # Such as you want to add new definitions or customize the footer. paths: report_path: "{{ work_dir }}/Report.md" footer_path: "templates/footer.tex" head_path: "files/head.tex" definitions_path: "files/Definitions.md" + default_vars_path: "files/vars.default.yml" + default_vault_path: "files/vault.default.yml" + default_vault_vars_path: "files/vars.vault.yml" diff --git a/vars/main.yml b/files/vars.default.yml similarity index 56% rename from vars/main.yml rename to files/vars.default.yml index e60413f..8a09dc7 100644 --- a/vars/main.yml +++ b/files/vars.default.yml @@ -1,4 +1,3 @@ -#SPDX-License-Identifier: MIT-0 --- author_name: "Testy McTestface Jr" document_title: "Home Performance Report" @@ -30,21 +29,3 @@ home: square_feet: "3,000" cfm50: "3,000" lair: "1:1" - - -# NOTE: These generally do not need changed, unless debugging. -# -build_dir_name: ".build" -work_dir: "{{ lookup('env', 'PWD') }}" -build_dir: "{{ work_dir }}/{{ build_dir_name }}" - -# NOTE: These generally do not need changed, unless debugging. -config: - - # NOTE: These generally do not need changed, unless debugging or customizing files. - # Such as you want to add new definitions or customize the latex footer. - paths: - report_path: "{{ work_dir }}/Report.md" - footer_path: "templates/footer.tex" - head_path: "files/head.tex" - definitions_path: "files/Definitions.md" diff --git a/files/vars.vault.yml b/files/vars.vault.yml index b1004c6..7cabc46 100644 --- a/files/vars.vault.yml +++ b/files/vars.vault.yml @@ -16,17 +16,3 @@ home: square_feet: "3,000" cfm50: "3,000" lair: "1:1" - -# NOTE: These generally do not need changed, unless debugging. -build_dir_name: ".build" -work_dir: "{{ lookup('env', 'PWD') }}" -build_dir: "{{ work_dir }}/{{ build_dir_name }}" - -config: - # NOTE: These generally do not need changed, unless debugging or customizing files. - # Such as you want to add new definitions or customize the footer. - paths: - report_path: "{{ work_dir }}/Report.md" - footer_path: "templates/footer.tex" - head_path: "files/head.tex" - definitions_path: "files/Definitions.md" diff --git a/tasks/setup.yml b/tasks/setup.yml index 6c4eb81..8b2bf2e 100644 --- a/tasks/setup.yml +++ b/tasks/setup.yml @@ -21,7 +21,7 @@ ansible.builtin.include_tasks: file: "copy_if_not_exists.yml" vars: - source: "templates/footer.tex" + source: "{{ config.paths.footer_path }}" destination: "{{ work_dir }}/footer.tex" tags: - setup-footer @@ -32,7 +32,7 @@ ansible.builtin.include_tasks: file: "copy_if_not_exists.yml" vars: - source: "files/head.tex" + source: "{{ config.paths.head_path }}" destination: "{{ work_dir }}/head.tex" tags: - setup-head @@ -43,7 +43,7 @@ ansible.builtin.include_tasks: file: "copy_if_not_exists.yml" vars: - source: "files/Definitions.md" + source: "{{ config.paths.definitions_path }}" destination: "{{ work_dir }}/Definitions.md" tags: - setup-definitions @@ -54,7 +54,7 @@ ansible.builtin.include_tasks: file: "copy_if_not_exists.yml" vars: - source: "defaults/main.yml" + source: "{{ config.paths.default_vars_path }}" destination: "{{ work_dir }}/vars.yml" tags: - setup @@ -64,7 +64,7 @@ ansible.builtin.include_tasks: file: "copy_if_not_exists.yml" vars: - source: "files/vars.vault.yml" + source: "{{ config.paths.default_vault_vars_path }}" destination: "{{ work_dir }}/vars.yml" tags: - setup-vault @@ -75,7 +75,7 @@ ansible.builtin.include_tasks: file: "copy_if_not_exists.yml" vars: - source: "files/vault.default.yml" + source: "{{ config.paths.default_vault_path }}" destination: "{{ work_dir }}/vault.yml" tags: - setup-vault diff --git a/tests/test.yml b/tests/test.yml index 9c29965..703a3d3 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -11,4 +11,24 @@ ansible.builtin.debug: msg: "Starting task..." - #- include_tasks: ../tasks/main.yml + - name: Ensure files exist in root working directory. + ansible.builtin.file: + path: "{{ work_dir }}/{{ item }}" + state: file + with_items: + - "Report.md" + - "Definitions.md" + - "footer.tex" + - "head.tex" + - "vars.yml" + - "vault.yml" + + - name: Ensure files exist in build directory. + ansible.builtin.file: + path: "{{ build_dir }}/{{ item }}" + state: file + with_items: + - "Report.md" + - "Definitions.md" + - "footer.tex" + - "head.tex"