diff options
author | Elizabeth Alexander Hunt <me@liz.coffee> | 2025-05-07 18:10:57 -0700 |
---|---|---|
committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2025-05-07 18:10:57 -0700 |
commit | b8ffbfe27eae919750ef4d3facf02393d1004287 (patch) | |
tree | 78a22cffd1a387a1f482aac78a93fb951dcc81bb /playbooks/roles/ci/templates/volumes/laminar/jobs/playbook.run | |
parent | 59417f290463d3aabbf3ec2ab8e75703928db217 (diff) | |
download | infra-b8ffbfe27eae919750ef4d3facf02393d1004287.tar.gz infra-b8ffbfe27eae919750ef4d3facf02393d1004287.zip |
.git was corrupted on the machine i worked on these many commits. so here it is all at once :P
Diffstat (limited to 'playbooks/roles/ci/templates/volumes/laminar/jobs/playbook.run')
-rwxr-xr-x | playbooks/roles/ci/templates/volumes/laminar/jobs/playbook.run | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/playbooks/roles/ci/templates/volumes/laminar/jobs/playbook.run b/playbooks/roles/ci/templates/volumes/laminar/jobs/playbook.run new file mode 100755 index 0000000..181a050 --- /dev/null +++ b/playbooks/roles/ci/templates/volumes/laminar/jobs/playbook.run @@ -0,0 +1,25 @@ +#!/bin/bash +# usage: laminarc queue playbook remote="ssh://src.liz.coffee:2222/infra" playbooks="deploy.yml playbooks/labdns.yml" + +set -e + +declare -a args=("$remote" "$playbooks") +for arg in "${args[@]}" +do + if [[ ! "$arg" =~ ^[[:alnum:]:_\ \.\/\-]*$ ]]; then + echo "Invalid argument format. Don't be sneaky snek (-_-)." + exit 1 + fi +done + +log "Cloning remote $remote" +r=$(echo "ansible-$(date --iso-8601=seconds)") +git clone "$remote" "$r" && cd "$r" + +get_secret "ansible_secrets" | jq -r '.notes' > secrets.yml +private_key=$(get_secret "ssh_key" | jq -r '.notes') + +env -i HOME="$HOME" ssh-agent bash -c "ssh-add <(echo \"$private_key\") && ansible-playbook -e @secrets.yml $playbooks" + +cd - +rm -rf "$r" |