Created
March 31, 2016 18:04
-
-
Save jonathanhle/741e7c0c86cfa51fb81cef9970a6ddd9 to your computer and use it in GitHub Desktop.
Sometimes you have to use the ansible raw module, sigh.
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
SG=JenkinsSG && ansible security_group_${SG} -m raw --args='export TempCurrentAnsibleRole=$(source /etc/default/ec2-metadata && source /etc/default/manage-authorized-keys && aws ec2 describe-tags --filter "Name=key,Values=AnsibleRole" "Name=resource-id,Values=$EC2_INSTANCE_ID" --output text) && export CurrentAnsibleRole=$(echo ${TempCurrentAnsibleRole} | cut -d " " -f 5-) && echo $CurrentAnsibleRole && CurrentServerRole=$(cat /etc/default/server-role | cut -c 20-) && echo $CurrentServerRole && if [ "${CurrentAnsibleRole}" == "${CurrentServerRole}" ]; then echo "AnsibleRole and ServerRole Match"; else echo "No Match" && exit 1; fi' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment