-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.yml
49 lines (38 loc) · 1.07 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
- hosts: all
vars:
- known_id: 68690761
tasks:
- name: http get
uri:
url: "https://api.github.com/users/dullaertd/repos"
method: GET
return_content: yes
body_format: json
register: output
- debug:
msg: "output: {{ output.json }}"
- debug:
var: item
# with_items: " {{ output.json | json_query('[*].name') }}"
with_items: " {{ output.json | map(attribute='id') | list }}"
- debug:
msg: "ids: {{ output.json | map(attribute='id') | join(',') }}"
- debug:
msg: "nested ids: {{ output.json | map(attribute='owner') | map(attribute='id') | list }}"
- name: http get nmbr 2
uri:
url: "https://api.github.com/repos/dullaertd/kafkaTools/labels"
method: GET
return_content: yes
body_format: json
register: output2
- debug:
msg: "ids: {{ output2.json | map(attribute='id') | join(',') }}"
- name: find key
set_fact:
key_found: True
with_items: "{{ output.json | map(attribute='id') | list }}"
when: "known_id == item"
- debug:
var: key_found