Last active
April 26, 2017 10:30
-
-
Save jas02/150e144d975077f7453a3a077c55a3dc to your computer and use it in GitHub Desktop.
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
add_api_key: | |
cmd.run: | |
- name: | | |
curl -s \ | |
-X POST \ | |
-k \ | |
-H 'Accept: application/json' \ | |
-H 'Content-Type: application/json' \ | |
-d '{"type":"apikey","accountId":"1a1","name":"{{ api_account_name }}","description":null,"created":null,"kind":null,"removeTime":null,"removed":null,"uuid":null}' \ | |
'https://{{ rancher_server }}/v1/apikey' > /root/api_key.json | |
- unless: | |
cat /root/api_key.json | jq {'name'} | grep -w {{ api_account_name }} | |
- require: | |
- file: /usr/bin/jq | |
{% set RANCHER_API_KEY_ACCOUNT_TOKEN = salt['cmd.run']('cat /root/api_key.json | jq .publicValue | cut -d \\" -f 2') %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment