mirror of
https://github.com/cole-maxwell1/todo-hetzner.git
synced 2026-10-27 19:02:49 -05:00
ops(ansible): harden provisioning and restore automation
Fail before host changes when required deployment variables are missing. Precreate the PostgreSQL temporary directory and escape Bash syntax during Jinja rendering.
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
---
|
||||
- name: Deploy todo application
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
become: true
|
||||
pre_tasks:
|
||||
- name: Validate required deployment configuration
|
||||
block:
|
||||
- name: Assert required deployment variables
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- app_db_password | default('', true) | length > 0
|
||||
- app_image | default('', true) | length > 0
|
||||
fail_msg: "Required deployment configuration is missing or invalid for {{ inventory_hostname }}."
|
||||
quiet: true
|
||||
any_errors_fatal: true
|
||||
roles:
|
||||
- app
|
||||
tasks:
|
||||
|
||||
Reference in New Issue
Block a user