feat: Updates hpa and config to mount home directory inside container.

This commit is contained in:
2025-11-07 15:59:40 -05:00
parent 0636832796
commit 9af452c849
4 changed files with 20 additions and 10 deletions

View File

@@ -1,3 +1,5 @@
# This config is setup for running inside the docker container.
#
# NOTE:
# Configuration settings for the `hpa` command line tool.
# You can delete settings that are not applicable to your use case.
@@ -42,8 +44,8 @@ useVaultArgs = true
# instead of the provided / default playbook.
[playbook]
directory = '/playbook'
inventory = '/playbook/inventory.ini'
directory = '~/.local/share/hpa/playbook'
inventory = '~/.local/share/hpa/playbook/inventory.ini'
version = 'main'
# NOTE:
@@ -51,7 +53,7 @@ version = 'main'
# a remote git repository.
[template]
# The directory path on your local system to the template files.
directory = '/template'
directory = '~/.local/share/hpa/template'
# The url to a git repository that contains your template files.
# url = 'https://git.example.com/consult-template.git'
@@ -66,7 +68,7 @@ directory = '/template'
[vault]
# Arguments to pass to commands that use `ansible-vault`, such as encrypting or decrypting
# files.
args = [ '--vault-password-file=/run/secrets/vault-pass' ]
args = ['--vault-password-file=/run/secrets/vault-pass']
# An id to use when encrypting `ansible-vault` files.
#encryptId = 'myId'

View File

@@ -9,6 +9,17 @@ set -o pipefail
#
# Make sure to run 'hpa-init' first on this machine to setup
# dependencies, if you have not done so already.
#
# This will mount my home directory inside the container, so
# it should somewhat mirror like commands are run on the host os.
#
# To attach to a shell inside the container run:
# `hpa bash`
#
# To run ansible vault commands inside the container run:
# `hpa ansible-vault ...`
#
#
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
. "$SCRIPTS/utils/hpa/hpa.env"
@@ -27,9 +38,6 @@ if [[ $HPA_AUTO_PULL == "1" ]] && [[ $diff -gt "$HPA_AUTO_PULL_INTERVAL" ]]; the
fi
podman run --rm --interactive --tty \
--volume "$HPA_DATA_DIR/template":/template \
--volume "$HPA_DATA_DIR/playbook":/playbook \
--volume "$HPA_CONFIG_DIR":/config/hpa \
--volume "$HPA_CONSULTS_DIR":/consults \
--volume "$HOME":/root \
--secret "$HPA_VAULT_SECRET_KEY" \
"$HPA_DOCKER_IMAGE:$HPA_DOCKER_TAG" "$@"

View File

@@ -105,4 +105,4 @@ fi
[[ $docker_flag == "1" ]] && pull-docker
[[ $playbook_flag == "1" ]] && pull-playbook
[[ $template_flag == "1" ]] && pull-template
echo "$(date +%s)" >>$HPA_CONFIG_DIR/.lastpull
date +%s >"$HPA_CONFIG_DIR/.lastpull"

2
env/.zshenv vendored
View File

@@ -68,7 +68,7 @@ export VAULT_ADDR="https://vault.housh.dev"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
# Tmux-Sessionator path.
export TMUX_SESSIONATOR_PATH="$HOME:$SCRIPTS:$HOME/.config/personal:$HOME/dev:$HOME/dev/homelab/utils:$HOME/dev/homelab/services:$HOME/work/consults:$HOME/work"
export TMUX_SESSIONATOR_PATH="$HOME:$SCRIPTS:$HOME/.config:$HOME/.config/personal:$HOME/dev:$HOME/dev/homelab/utils:$HOME/dev/homelab/services:$HOME/work/consults:$HOME/work"
# Password-store
# export PASSWORD_STORE_DIR="$XDG_DATA_HOME/gopass/stores/root"