mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 23:49:56 +00:00
Use subshell in ap to cd to playbook directory
This commit is contained in:
@@ -3,7 +3,10 @@
|
|||||||
ap() {
|
ap() {
|
||||||
export PLAYBOOK_DIR="${PLAYBOOK_DIR:-$HOME/AnsiblePlaybook}"
|
export PLAYBOOK_DIR="${PLAYBOOK_DIR:-$HOME/AnsiblePlaybook}"
|
||||||
|
|
||||||
local cmd=(ansible-playbook "$PLAYBOOK_DIR/ansible/site.yml" -l "$HOSTNAME" -K)
|
(
|
||||||
|
cd "$PLAYBOOK_DIR"
|
||||||
|
|
||||||
|
local cmd=(ansible-playbook ansible/site.yml -l "$HOSTNAME" -K)
|
||||||
|
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
cmd+=(--tag "$1")
|
cmd+=(--tag "$1")
|
||||||
@@ -11,4 +14,5 @@ ap() {
|
|||||||
|
|
||||||
printf '+ %s\n' "${cmd[*]}"
|
printf '+ %s\n' "${cmd[*]}"
|
||||||
"${cmd[@]}"
|
"${cmd[@]}"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user