Created
September 29, 2015 14:48
-
-
Save pratikmallya/71562b7afc643b20e0be to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #cloud-config | |
| write_files: | |
| - path: /root/hello-world.txt | |
| content: | | |
| #!/bin/bash | |
| username=XXXXXX | |
| APIkey=XXXXXX | |
| dc=hkg | |
| container=dn-container | |
| file=xyz.tar.gz | |
| token() { | |
| token=`curl -s "https://identity.api.rackspacecloud.com/v2.0/tokens" -X POST \ | |
| -d '{"auth":{"RAX-KSKEY:apiKeyCredentials":{"username":"'$username'", "apiKey":"'$APIkey'"}}}' \ | |
| -H "Content-Type: application/json" | python -m json.tool | sed -n '/expires/{n;p;}' |sed -e 's/^.*"id": "\(.*\)",/\1/'` | |
| echo "Your API Token is ----> $token" > /root/token.txt | |
| } | |
| token | |
| Output (in cloud server): | |
| root@test-server:~# cat hello-world.txt | |
| username=XXXXXX | |
| APIkey=XXXXXX | |
| dc=hkg | |
| container=dn-container | |
| file=xyz.tar.gz | |
| token() { | |
| token=`curl -s "https://identity.api.rackspacecloud.com/v2.0/tokens" -X POST undefined | |
| -d '{"auth":{"RAX-KSKEY:apiKeyCredentials":{"username":"'$username'", "apiKey":"'$APIkey'"}}}' undefined | |
| -H "Content-Type: application/json" | python -m json.tool | sed -n '/expires/{n;p;}' |sed -e 's/^.*"id": "undefined(.*undefined)",/undefined1/'` | |
| echo "Your API Token is ----> $token" > /root/token.txt | |
| } | |
| token |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment