Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
b3e1f90233
|
|||
|
2568d38911
|
|||
|
88cd7c9033
|
|||
|
4d011d2f75
|
@@ -31,16 +31,30 @@ home:
|
||||
cfm50: "3,000"
|
||||
lair: "1:1"
|
||||
|
||||
# NOTE: These generally do not need changed, unless debugging.
|
||||
config:
|
||||
build_dir_name: ".build"
|
||||
work_dir: "{{ lookup('env', 'PWD') }}"
|
||||
build_dir: "{{ config.work_dir }}/{{ config.build_dir_name }}"
|
||||
# NOTE: You generally want to pass this in when running the playbook.
|
||||
work_dir: "{{ lookup('env', 'PWD') }}"
|
||||
|
||||
|
||||
# NOTE: The below variables generally do not need changed, unless debugging or customizing files.
|
||||
# Such as you want to add new definitions, customize the footer or change the
|
||||
# build directory name, etc.
|
||||
build_dir_name: ".build"
|
||||
build_dir: "{{ work_dir }}/{{ build_dir_name }}"
|
||||
|
||||
config:
|
||||
default_files:
|
||||
definitions: "files/Definitions.md"
|
||||
footer: "templates/footer.tex"
|
||||
head: "files/head.tex"
|
||||
report_template: "templates/Report.md"
|
||||
vars: "files/vars.default.yml"
|
||||
vault: "files/vault.default.yml"
|
||||
|
||||
# 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: "{{ config.work_dir }}/Report.md"
|
||||
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"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
- name: Debug.
|
||||
ansible.builtin.debug:
|
||||
msg: "Using {{ config.build_dir }}"
|
||||
msg: "Using {{ build_dir }}"
|
||||
tags:
|
||||
- debug
|
||||
|
||||
- name: Ensure build directory exists.
|
||||
ansible.builtin.file:
|
||||
path: "{{ config.build_dir }}"
|
||||
path: "{{ build_dir }}"
|
||||
state: "directory"
|
||||
mode: '0755'
|
||||
tags:
|
||||
@@ -16,7 +16,7 @@
|
||||
- name: Copy Build Files.
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ config.build_dir }}/{{ item.dest }}"
|
||||
dest: "{{ build_dir }}/{{ item.dest }}"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- src: "{{ config.paths.definitions_path }}"
|
||||
@@ -29,7 +29,7 @@
|
||||
- name: Build Templated Files
|
||||
ansible.builtin.template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ config.build_dir }}/{{ item.dest }}"
|
||||
dest: "{{ build_dir }}/{{ item.dest }}"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- src: "{{ config.paths.report_path }}"
|
||||
|
||||
19
tasks/copy_if_not_exists.yml
Normal file
19
tasks/copy_if_not_exists.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
# NOTE: This is just an internal task that checks if a file exists
|
||||
# before copying, to prevent changes from being overwritten.
|
||||
#
|
||||
- name: "Check if {{ destination | basename }} exists already."
|
||||
ansible.builtin.stat:
|
||||
path: "{{ destination }}"
|
||||
register: filestat
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: "Copy {{ destination | basename }} file."
|
||||
ansible.builtin.copy:
|
||||
src: "{{ source }}"
|
||||
dest: "{{ destination }}"
|
||||
mode: "{{ mode | default('0600') }}"
|
||||
when: not filestat.stat.exists
|
||||
tags:
|
||||
- always
|
||||
104
tasks/setup.yml
104
tasks/setup.yml
@@ -1,90 +1,82 @@
|
||||
---
|
||||
- name: Copy Report Template File
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- src: "templates/Report.md"
|
||||
dest: "Report.md"
|
||||
- name: Starting setup.
|
||||
ansible.builtin.debug:
|
||||
msg: "Working Directory: {{ work_dir }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Copy Report File if not exists.
|
||||
ansible.builtin.include_tasks:
|
||||
file: "copy_if_not_exists.yml"
|
||||
vars:
|
||||
source: "templates/Report.md"
|
||||
destination: "{{ work_dir }}/Report.md"
|
||||
tags:
|
||||
- setup
|
||||
- setup-all
|
||||
- setup-all-with-vault
|
||||
- setup-with-vault
|
||||
|
||||
- name: Copy Footer Template File
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- src: "templates/footer.tex"
|
||||
dest: "footer.tex"
|
||||
- name: "Copy footer if not exists."
|
||||
ansible.builtin.include_tasks:
|
||||
file: "copy_if_not_exists.yml"
|
||||
vars:
|
||||
source: "{{ config.paths.footer_path }}"
|
||||
destination: "{{ work_dir }}/footer.tex"
|
||||
tags:
|
||||
- setup-footer
|
||||
- setup-all
|
||||
- setup-all-with-vault
|
||||
|
||||
- name: Copy Head File
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- src: "files/head.tex"
|
||||
dest: "head.tex"
|
||||
- name: "Copy head if not exists."
|
||||
ansible.builtin.include_tasks:
|
||||
file: "copy_if_not_exists.yml"
|
||||
vars:
|
||||
source: "{{ config.paths.head_path }}"
|
||||
destination: "{{ work_dir }}/head.tex"
|
||||
tags:
|
||||
- setup-head
|
||||
- setup-all
|
||||
- setup-all-with-vault
|
||||
|
||||
- name: Copy Definitions File
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- src: "files/Definitions.md"
|
||||
dest: "Definitions.md"
|
||||
- name: "Copy Definitions if not exists."
|
||||
ansible.builtin.include_tasks:
|
||||
file: "copy_if_not_exists.yml"
|
||||
vars:
|
||||
source: "{{ config.paths.definitions_path }}"
|
||||
destination: "{{ work_dir }}/Definitions.md"
|
||||
tags:
|
||||
- setup-definitions
|
||||
- setup-all
|
||||
- setup-all-with-vault
|
||||
|
||||
- name: Copy Vars File
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- src: "files/vars.default.yml"
|
||||
dest: "vars.yml"
|
||||
- name: "Copy vars if not exists."
|
||||
ansible.builtin.include_tasks:
|
||||
file: "copy_if_not_exists.yml"
|
||||
vars:
|
||||
source: "{{ config.paths.default_vars_path }}"
|
||||
destination: "{{ work_dir }}/vars.yml"
|
||||
tags:
|
||||
- setup
|
||||
- setup-all
|
||||
|
||||
- name: Copy Vars File
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- src: "files/vars.vault.yml"
|
||||
dest: "vars.yml"
|
||||
- name: "Copy vars if not exists."
|
||||
ansible.builtin.include_tasks:
|
||||
file: "copy_if_not_exists.yml"
|
||||
vars:
|
||||
source: "{{ config.paths.default_vault_vars_path }}"
|
||||
destination: "{{ work_dir }}/vars.yml"
|
||||
tags:
|
||||
- setup-vault
|
||||
- setup-with-vault
|
||||
- setup-all-with-vault
|
||||
|
||||
- name: Copy Vault Vars File
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- src: "files/vault.default.yml"
|
||||
dest: "vault.yml"
|
||||
- name: "Copy vault if not exists."
|
||||
ansible.builtin.include_tasks:
|
||||
file: "copy_if_not_exists.yml"
|
||||
vars:
|
||||
source: "{{ config.paths.default_vault_path }}"
|
||||
destination: "{{ work_dir }}/vault.yml"
|
||||
tags:
|
||||
- setup-vault
|
||||
- setup-with-vault
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
author_name: "Testy McTestface Jr"
|
||||
document_title: "Home Performance Report"
|
||||
company:
|
||||
website: "https://example.com"
|
||||
phone: "555-555-5555"
|
||||
url_display_title: "www.Example.com"
|
||||
|
||||
links:
|
||||
images:
|
||||
logo: "img/logo.png"
|
||||
trueflow: "img/trueflow.png"
|
||||
trueflow_forecast: "img/forecast.png"
|
||||
documents:
|
||||
loads_folder: "https://example.com/path/to/loads/folder"
|
||||
trueflow_file: "https://example.com/path/to/trueflow/file"
|
||||
trueflow_forecast_file: "https://example.com/path/to/trueflow/forecast/file"
|
||||
document_folder: "https://example.com/path/to/document/folder"
|
||||
|
||||
customer:
|
||||
name: "Testy McTestface Sr"
|
||||
address:
|
||||
street: "1234 Seasme Street"
|
||||
city: "No Mans Land"
|
||||
state: "Foo"
|
||||
zip: "55555"
|
||||
|
||||
home:
|
||||
square_feet: "3,000"
|
||||
cfm50: "3,000"
|
||||
lair: "1:1"
|
||||
|
||||
config:
|
||||
build_dir: "/tmp/hpa-role/.build"
|
||||
work_dir: "/tmp/hpa-role"
|
||||
|
||||
paths:
|
||||
report_path: "templates/Report.md"
|
||||
footer_path: "templates/footer.tex"
|
||||
head_path: "files/head.tex"
|
||||
definitions_path: "files/Definitions.md"
|
||||
Reference in New Issue
Block a user