Last active
August 29, 2015 14:05
-
-
Save libero18/90ef4217366db6300d6b to your computer and use it in GitHub Desktop.
ansible-playbook xxxxxxxxx.yml 実行時にEXTRA_VARSとして git のリビジョン番号をセットさせたい場合
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ansible-playbook_wrapper() { | |
if [ $(git log -n 1 >/dev/null 2>&1 ; echo $?) -eq 0 ]; then | |
\ansible-playbook $@ -e "playbook_version=$(git log -n 1 | head -n 1 | awk -F " " '{print $2}')" | |
else | |
\ansible-playbook $@ | |
fi | |
} | |
alias ansible-playbook=ansible-playbook_wrapper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment