Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
b3e1f90233
|
|||
|
2568d38911
|
|||
|
88cd7c9033
|
|||
|
4d011d2f75
|
@@ -31,16 +31,30 @@ home:
|
|||||||
cfm50: "3,000"
|
cfm50: "3,000"
|
||||||
lair: "1:1"
|
lair: "1:1"
|
||||||
|
|
||||||
# NOTE: These generally do not need changed, unless debugging.
|
# NOTE: You generally want to pass this in when running the playbook.
|
||||||
config:
|
work_dir: "{{ lookup('env', 'PWD') }}"
|
||||||
build_dir_name: ".build"
|
|
||||||
work_dir: "{{ lookup('env', 'PWD') }}"
|
|
||||||
build_dir: "{{ config.work_dir }}/{{ config.build_dir_name }}"
|
# 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:
|
paths:
|
||||||
report_path: "{{ config.work_dir }}/Report.md"
|
report_path: "{{ work_dir }}/Report.md"
|
||||||
footer_path: "templates/footer.tex"
|
footer_path: "templates/footer.tex"
|
||||||
head_path: "files/head.tex"
|
head_path: "files/head.tex"
|
||||||
definitions_path: "files/Definitions.md"
|
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.
|
- name: Debug.
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Using {{ config.build_dir }}"
|
msg: "Using {{ build_dir }}"
|
||||||
tags:
|
tags:
|
||||||
- debug
|
- debug
|
||||||
|
|
||||||
- name: Ensure build directory exists.
|
- name: Ensure build directory exists.
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ config.build_dir }}"
|
path: "{{ build_dir }}"
|
||||||
state: "directory"
|
state: "directory"
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
tags:
|
tags:
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
- name: Copy Build Files.
|
- name: Copy Build Files.
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
dest: "{{ config.build_dir }}/{{ item.dest }}"
|
dest: "{{ build_dir }}/{{ item.dest }}"
|
||||||
mode: '0600'
|
mode: '0600'
|
||||||
with_items:
|
with_items:
|
||||||
- src: "{{ config.paths.definitions_path }}"
|
- src: "{{ config.paths.definitions_path }}"
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
- name: Build Templated Files
|
- name: Build Templated Files
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
dest: "{{ config.build_dir }}/{{ item.dest }}"
|
dest: "{{ build_dir }}/{{ item.dest }}"
|
||||||
mode: '0600'
|
mode: '0600'
|
||||||
with_items:
|
with_items:
|
||||||
- src: "{{ config.paths.report_path }}"
|
- 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
|
- name: Starting setup.
|
||||||
ansible.builtin.copy:
|
ansible.builtin.debug:
|
||||||
src: "{{ item.src }}"
|
msg: "Working Directory: {{ work_dir }}"
|
||||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
tags:
|
||||||
mode: '0600'
|
- always
|
||||||
with_items:
|
|
||||||
- src: "templates/Report.md"
|
- name: Copy Report File if not exists.
|
||||||
dest: "Report.md"
|
ansible.builtin.include_tasks:
|
||||||
|
file: "copy_if_not_exists.yml"
|
||||||
|
vars:
|
||||||
|
source: "templates/Report.md"
|
||||||
|
destination: "{{ work_dir }}/Report.md"
|
||||||
tags:
|
tags:
|
||||||
- setup
|
- setup
|
||||||
- setup-all
|
- setup-all
|
||||||
- setup-all-with-vault
|
- setup-all-with-vault
|
||||||
- setup-with-vault
|
- setup-with-vault
|
||||||
|
|
||||||
- name: Copy Footer Template File
|
- name: "Copy footer if not exists."
|
||||||
ansible.builtin.copy:
|
ansible.builtin.include_tasks:
|
||||||
src: "{{ item.src }}"
|
file: "copy_if_not_exists.yml"
|
||||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
vars:
|
||||||
mode: '0600'
|
source: "{{ config.paths.footer_path }}"
|
||||||
with_items:
|
destination: "{{ work_dir }}/footer.tex"
|
||||||
- src: "templates/footer.tex"
|
|
||||||
dest: "footer.tex"
|
|
||||||
tags:
|
tags:
|
||||||
- setup-footer
|
- setup-footer
|
||||||
- setup-all
|
- setup-all
|
||||||
- setup-all-with-vault
|
- setup-all-with-vault
|
||||||
|
|
||||||
- name: Copy Head File
|
- name: "Copy head if not exists."
|
||||||
ansible.builtin.copy:
|
ansible.builtin.include_tasks:
|
||||||
src: "{{ item.src }}"
|
file: "copy_if_not_exists.yml"
|
||||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
vars:
|
||||||
mode: '0600'
|
source: "{{ config.paths.head_path }}"
|
||||||
with_items:
|
destination: "{{ work_dir }}/head.tex"
|
||||||
- src: "files/head.tex"
|
|
||||||
dest: "head.tex"
|
|
||||||
tags:
|
tags:
|
||||||
- setup-head
|
- setup-head
|
||||||
- setup-all
|
- setup-all
|
||||||
- setup-all-with-vault
|
- setup-all-with-vault
|
||||||
|
|
||||||
- name: Copy Definitions File
|
- name: "Copy Definitions if not exists."
|
||||||
ansible.builtin.copy:
|
ansible.builtin.include_tasks:
|
||||||
src: "{{ item.src }}"
|
file: "copy_if_not_exists.yml"
|
||||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
vars:
|
||||||
mode: '0600'
|
source: "{{ config.paths.definitions_path }}"
|
||||||
with_items:
|
destination: "{{ work_dir }}/Definitions.md"
|
||||||
- src: "files/Definitions.md"
|
|
||||||
dest: "Definitions.md"
|
|
||||||
tags:
|
tags:
|
||||||
- setup-definitions
|
- setup-definitions
|
||||||
- setup-all
|
- setup-all
|
||||||
- setup-all-with-vault
|
- setup-all-with-vault
|
||||||
|
|
||||||
- name: Copy Vars File
|
- name: "Copy vars if not exists."
|
||||||
ansible.builtin.copy:
|
ansible.builtin.include_tasks:
|
||||||
src: "{{ item.src }}"
|
file: "copy_if_not_exists.yml"
|
||||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
vars:
|
||||||
mode: '0600'
|
source: "{{ config.paths.default_vars_path }}"
|
||||||
with_items:
|
destination: "{{ work_dir }}/vars.yml"
|
||||||
- src: "files/vars.default.yml"
|
|
||||||
dest: "vars.yml"
|
|
||||||
tags:
|
tags:
|
||||||
- setup
|
- setup
|
||||||
- setup-all
|
- setup-all
|
||||||
|
|
||||||
- name: Copy Vars File
|
- name: "Copy vars if not exists."
|
||||||
ansible.builtin.copy:
|
ansible.builtin.include_tasks:
|
||||||
src: "{{ item.src }}"
|
file: "copy_if_not_exists.yml"
|
||||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
vars:
|
||||||
mode: '0600'
|
source: "{{ config.paths.default_vault_vars_path }}"
|
||||||
with_items:
|
destination: "{{ work_dir }}/vars.yml"
|
||||||
- src: "files/vars.vault.yml"
|
|
||||||
dest: "vars.yml"
|
|
||||||
tags:
|
tags:
|
||||||
- setup-vault
|
- setup-vault
|
||||||
- setup-with-vault
|
- setup-with-vault
|
||||||
- setup-all-with-vault
|
- setup-all-with-vault
|
||||||
|
|
||||||
- name: Copy Vault Vars File
|
- name: "Copy vault if not exists."
|
||||||
ansible.builtin.copy:
|
ansible.builtin.include_tasks:
|
||||||
src: "{{ item.src }}"
|
file: "copy_if_not_exists.yml"
|
||||||
dest: "{{ config.work_dir }}/{{ item.dest }}"
|
vars:
|
||||||
mode: '0600'
|
source: "{{ config.paths.default_vault_path }}"
|
||||||
with_items:
|
destination: "{{ work_dir }}/vault.yml"
|
||||||
- src: "files/vault.default.yml"
|
|
||||||
dest: "vault.yml"
|
|
||||||
tags:
|
tags:
|
||||||
- setup-vault
|
- setup-vault
|
||||||
- setup-with-vault
|
- setup-with-vault
|
||||||
|
|||||||
@@ -11,4 +11,24 @@
|
|||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Starting task..."
|
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