Skip to content

Instantly share code, notes, and snippets.

@jas02
Last active April 26, 2017 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jas02/150e144d975077f7453a3a077c55a3dc to your computer and use it in GitHub Desktop.
Save jas02/150e144d975077f7453a3a077c55a3dc to your computer and use it in GitHub Desktop.
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