Skip to content

Instantly share code, notes, and snippets.

@eumel8
Last active August 15, 2017 18:02
Show Gist options
  • Save eumel8/6d9422476f6da2e7a84dceb2c125bd55 to your computer and use it in GitHub Desktop.
Save eumel8/6d9422476f6da2e7a84dceb2c125bd55 to your computer and use it in GitHub Desktop.
---
- hosts: "localhost"
gather_facts: no
tasks:
- name: Search for projects
uri:
url: "https://translate.openstack.org/rest/projects"
method: GET
return_content: yes
validate_certs: yes
headers:
Accept: application/json
register: projectlist
- name: Search for versions
uri:
url: "https://translate.openstack.org/rest/projects/p/{{ item }}"
method: GET
return_content: yes
validate_certs: yes
status_code: 200,201,202,203,204,404
headers:
Accept: application/json
register: versionlist
with_items:
- "{{ (projectlist.content|from_json)|json_query('[].id') }}"
- name: Set fact versions
set_fact:
versions: "{{ versionlist|json_query('results[].json[].{ id: id, branch: iterations[].id } ') }}"
- name: List projects and versions
debug:
msg: "{{ versions }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment