mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 15:39:58 +00:00
Add ap function to run Ansible playbook from any directory
This commit is contained in:
14
dotfiles/desktop/.bashrc.d/50-ap.sh
Executable file
14
dotfiles/desktop/.bashrc.d/50-ap.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
ap() {
|
||||
export PLAYBOOK_DIR="${PLAYBOOK_DIR:-$HOME/AnsiblePlaybook}"
|
||||
|
||||
local cmd=(ansible-playbook "$PLAYBOOK_DIR/ansible/site.yml" -l "$HOSTNAME" -K)
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
cmd+=(--tag "$1")
|
||||
fi
|
||||
|
||||
printf '+ %s\n' "${cmd[*]}"
|
||||
"${cmd[@]}"
|
||||
}
|
||||
Reference in New Issue
Block a user