feat: Begins cleaning up ansible
This commit is contained in:
19
Makefile
19
Makefile
@@ -2,7 +2,7 @@ PDF_TITLE ?= "Report.pdf"
|
||||
TEX_TITLE ?= "Report.tex"
|
||||
HTML_TITLE ?= "report.html"
|
||||
OUT_FILE ?= "Report.md"
|
||||
OUT_DIR ?= "outfiles"
|
||||
OUT_DIR ?= "${PWD}/outfiles"
|
||||
PDF_TEST_TITLE ?= "Report.test.pdf"
|
||||
|
||||
.PHONY: gen
|
||||
@@ -49,7 +49,22 @@ install:
|
||||
@brew install pandoc \
|
||||
mactex-no-gui \
|
||||
imagemagick \
|
||||
gettext
|
||||
gettext \
|
||||
ansible
|
||||
|
||||
.PHONY: ansible
|
||||
ansible:
|
||||
@cd ./ansible && \
|
||||
ansible-playbook playbook.yaml \
|
||||
--extra-vars "output_path=${OUT_DIR}"
|
||||
|
||||
.PHONY: ansible-vault-example
|
||||
ansible-vault-example:
|
||||
@cd ./ansible && \
|
||||
ansible-playbook playbook.yaml \
|
||||
--extra-vars "output_path=${OUT_DIR}"
|
||||
--extra-vars "@group_vars/vault_example/vars.yaml" \
|
||||
--extra-vars "@group_vars/vault_example/vault.yaml" \
|
||||
|
||||
@.PHONY: clean
|
||||
clean:
|
||||
|
||||
33
ansible/roles/report/defaults/main.yaml
Normal file
33
ansible/roles/report/defaults/main.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
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"
|
||||
|
||||
output_path: "outfiles"
|
||||
36
ansible/roles/report/tasks/main.yaml
Normal file
36
ansible/roles/report/tasks/main.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
|
||||
- name: Ensure output directory exists.
|
||||
ansible.builtin.file:
|
||||
path: "{{ output_path }}"
|
||||
state: "directory"
|
||||
mode: '0755'
|
||||
|
||||
- name: Copy Files.
|
||||
ansible.builtin.copy:
|
||||
src: "files/{{ item }}"
|
||||
dest: "{{ output_path }}/{{ item }}"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- "Definitions.md"
|
||||
- "head.tex"
|
||||
|
||||
- name: Generate Footer File
|
||||
ansible.builtin.template:
|
||||
src: "templates/{{ item }}"
|
||||
dest: "{{ output_path }}/footer.tex"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- "footer.tex"
|
||||
tags:
|
||||
- footer
|
||||
|
||||
- name: Generate Templated Report File
|
||||
ansible.builtin.template:
|
||||
src: "templates/{{ item }}"
|
||||
dest: "{{ output_path }}/Report.md"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- "Report.md"
|
||||
tags:
|
||||
- report
|
||||
@@ -1,22 +0,0 @@
|
||||
---
|
||||
- name: Generate Footer File
|
||||
ansible.builtin.template:
|
||||
src: "templates/{{ item }}"
|
||||
dest: "{{ output_path }}/footer.tex"
|
||||
mode: "0600"
|
||||
# variable_end_string: '[%'
|
||||
# variable_start_string: '%]'
|
||||
with_items:
|
||||
- "footer.tex"
|
||||
tags:
|
||||
- footer
|
||||
|
||||
- name: Generate Templated Files
|
||||
ansible.builtin.template:
|
||||
src: "templates/{{ item }}"
|
||||
dest: "{{ output_path }}/Report.md"
|
||||
mode: "0600"
|
||||
with_items:
|
||||
- "Report.md"
|
||||
tags:
|
||||
- report
|
||||
29
vars.sh
29
vars.sh
@@ -1,29 +0,0 @@
|
||||
#!/bin/zsh
|
||||
|
||||
# Document setup.
|
||||
export AUTHOR_NAME="Testy McTestface"
|
||||
export COMPANY_WEBSITE="https://example.com"
|
||||
export DOCUMENT_TITLE="Home Performance Report"
|
||||
export COMPANY_WEBSITE_DISPLAY="www.Example.com"
|
||||
export COMPANY_PHONE="555-555-5555"
|
||||
|
||||
# Image paths.
|
||||
export LOGO_IMAGE="img/logo.png"
|
||||
export TRUEFLOW_IMAGE="img/trueflow.png"
|
||||
export TRUEFLOW_FORECAST_IMAGE="img/forecast.png"
|
||||
|
||||
# Customer info.
|
||||
export CUSTOMER_NAME="Testy McTestface"
|
||||
export CUSTOMER_STREET="1234 Seasme Street"
|
||||
export CUSTOMER_CITY_STATE_ZIP="Monroe, OH 45044"
|
||||
|
||||
# Home variables.
|
||||
export HOME_LEAKAGE="4,186"
|
||||
export HOME_SQUARE_FEET="1,350"
|
||||
export HOME_LAIR="3:1"
|
||||
|
||||
# File links
|
||||
export LOADS_FOLDER="https://example.com/path/to/loads/folder"
|
||||
export TRUEFLOW_FILE="https://example.com/path/to/trueflow/file"
|
||||
export TRUEFLOW_FORECAST_FILE="https://example.com/path/to/trueflow/forecast/file"
|
||||
export DOCUMENT_FOLDER="https://example.com/path/to/document/folder"
|
||||
Reference in New Issue
Block a user