Skip to content

Instantly share code, notes, and snippets.

@eumel8
Created August 11, 2017 09:41
Show Gist options
  • Save eumel8/94bf107edca947d2ad2f9c326e0c5447 to your computer and use it in GitHub Desktop.
Save eumel8/94bf107edca947d2ad2f9c326e0c5447 to your computer and use it in GitHub Desktop.
[otc] search ecs instances by tags
- name: Request ecs list by tags from ECS API
uri:
url: "{{ AUTH_URL_ECS }}/servers?tags={{ mykey }}.{{ myvalue }}"
method: GET
return_content: yes
validate_certs: yes
HEADER_Content-Type: "application/json"
HEADER_X-Auth-Token: "{{ token['x_subject_token'] }}"
register: ecslist
- debug:
msg: "{{ (ecslist.content|from_json)|json_query('servers[].name') }}"
# ansible-playbook ecs.yml -e "mykey=mykey" -e "myvalue=myvalue"
@eumel8
Copy link
Author

eumel8 commented Aug 11, 2017

extended roles/ecs/tasks/main.yml with tags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment