Reputation:
I've started use ansible for configuring my VM's. But for an applied playbook, I using the full path for it. How can I set default playbooks path for ansible?
Upvotes: 3
Views: 6859
Reputation: 68269
This is not an ansible question, more like bash.
You may add alias to your .bash_profile
like this:
alias ansible-pb=anspb
anspb() {
ANS_DIR=/home/foo/playbook;
echo "Changing to $ANS_DIR and executing: ansible-playbook $@"
(cd $ANS_DIR; ansible-playbook $@)
}
Then just call ansible-pb bar.yml
to call a subshell, that changes to the ANS_DIR
directory and pass all arguments to ansible-playbook
.
Upvotes: 4