Skip to content

Instantly share code, notes, and snippets.

@jonathanhle
Created March 31, 2016 18:04
Show Gist options
  • Save jonathanhle/741e7c0c86cfa51fb81cef9970a6ddd9 to your computer and use it in GitHub Desktop.
Save jonathanhle/741e7c0c86cfa51fb81cef9970a6ddd9 to your computer and use it in GitHub Desktop.
Sometimes you have to use the ansible raw module, sigh.
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