/
/
/
Ansible role that deploys a supervised home assistant installation on my homeassistant device.
1---
2# Home Assistant Role - Vault Variable Validation
3# Fail fast if critical vault secrets are missing or malformed
4
5- name: Validate Semaphore credentials
6 ansible.builtin.assert:
7 that:
8 - homeassistant_semaphore_admin_password | default('') | length > 0
9 - homeassistant_semaphore_access_key_encryption | default('') | length > 0
10 fail_msg: |
11 Missing Semaphore credentials.
12 Ensure vault_homeassistant contains: semaphore_admin_password, semaphore_access_key_encryption
13 success_msg: "Semaphore credentials validated"
14 when: homeassistant_semaphore_enabled | bool
15
16# 32 random bytes base64-encode to exactly 43 characters plus one '=' pad
17- name: Validate Semaphore access key encryption format
18 ansible.builtin.assert:
19 that:
20 - homeassistant_semaphore_access_key_encryption is match('^[A-Za-z0-9+/]{43}=$')
21 fail_msg: |
22 vault_homeassistant.semaphore_access_key_encryption must be 32 bytes, base64 encoded.
23 Generate one with: head -c32 /dev/urandom | base64
24 success_msg: "Semaphore access key encryption format validated"
25 when: homeassistant_semaphore_enabled | bool
26
27- name: Validate CrowdSec agent credentials
28 ansible.builtin.assert:
29 that:
30 - homeassistant_crowdsec_lapi_host | default('') | length > 0
31 - homeassistant_crowdsec_agent_password | default('') | length > 0
32 fail_msg: |
33 Missing CrowdSec agent credentials.
34 Ensure vault_homeassistant contains: crowdsec_lapi_host, crowdsec_agent_password
35 success_msg: "CrowdSec credentials validated"
36 when:
37 - homeassistant_npm_enabled | bool
38 - homeassistant_crowdsec_enabled | bool
39