currently i am getting output in 2 different array: (ip addresses are dummy)
['10.32.142.156', '10.32.142.153', '10.32.31.177', '10.32.31.176', '10.32.31.175', '10.32.31.180', '10.32.31.179', '10.32.143.174', '10.32.143.173', '10.32.143.175', '10.32.141.40', '10.32.141.37', '10.32.41.155', '10.32.41.154', '10.32.41.156', '10.32.142.157', '10.32.142.161', '10.32.142.162', '10.32.142.151', '10.32.142.160', '10.32.144.166', '10.32.144.164', '10.32.144.167', '10.32.144.173', '10.32.144.172', '10.32.50.177', '10.32.50.176', '10.32.50.178', '10.32.141.3', '10.32.141.2', '10.32.141.7', '10.32.141.8', '10.32.141.17', '10.32.30.195', '10.32.30.196', '10.32.30.193', '10.32.30.194', '10.32.142.194', '10.32.142.193', '10.32.141.66', '10.32.141.68', '10.32.141.103', '10.32.141.102', '10.32.40.154', '10.32.40.155', '10.32.40.156', '10.32.51.155', '10.32.51.156', '10.32.51.157'] ['10.32.142.156', '10.32.142.153', '10.32.31.177', '10.32.31.176', '10.32.31.175', '10.32.31.180', '10.32.31.179', '10.32.143.174', '10.32.143.173', '10.32.143.175', '10.32.141.40', '10.32.141.37', '10.32.41.155', '10.32.41.154', '10.32.41.156', '10.32.142.157', '10.32.142.161', '10.32.142.162', '10.32.142.151', '10.32.142.160', '10.32.144.166', '10.32.144.164', '10.32.144.167', '10.32.144.173', '10.32.144.172', '10.32.50.177', '10.32.50.176', '10.32.50.178', '10.32.141.3', '10.32.141.2', '10.32.141.7', '10.32.141.8', '10.32.141.17', '10.32.30.195', '10.32.30.196', '10.32.30.193', '10.32.30.194', '10.32.142.194', '10.32.142.193', '10.32.141.66', '10.32.141.68', '10.32.141.103', '10.32.141.102', '10.32.40.154', '10.32.40.155', '10.32.40.156', '10.32.51.155', '10.32.51.156', '10.32.51.157'] i would like to merge these ips into a single array. and how can i merge input and input1? On Tue, Mar 23, 2021 at 1:10 PM Dick Visser <[email protected]> wrote: > What do you mean by 'merging json queries'? > I know json data structures can be merged, but queries? > > For example you can merge input and input1 into a new structure, and > then have a single json_query? > Or ....? > > On Tue, 23 Mar 2021 at 13:02, Sakshi Rathore <[email protected]> > wrote: > > > > hello all, > > > > i am getting 2 array of ips from 2 different json queries in > ansible-playbook. how can i merge these 2 json queries? > > > > in below example i want to merge jmesquery and jmesquery1 > > > > - name: master ip list from json content > > #debug: msg="{{ input | json_query(jmesquery) }}" > > copy: content="{{ input | json_query(jmesquery) }}" > dest=../ip_address.txt > > vars: > > input : "{{ lookup('template', '../cluster.txt') }}" > > target: "{{ input | json_query(jmesquery) }}" > > jmesquery: "[*].master_group[].nodes[].private_ip" > > > > - name: worker ip list from json content > > #debug: msg="{{ input1 | json_query(jmesquery1) }}" > > copy: content="{{ input1 | json_query(jmesquery1) }}" > dest=../ip_address1.txt > > vars: > > input1 : "{{ lookup('template', '../cluster.txt') }}" > > target1: "{{ input1 | json_query(jmesquery1) }}" > > jmesquery1: "[*].node_groups[].nodes[].private_ip" > > > > please advise. > > > > -- > > You received this message because you are subscribed to the Google > Groups "Ansible Project" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/7b967fa6-9c7a-46d5-aea9-a7123af2ac06n%40googlegroups.com > . > > > > -- > Dick Visser > Trust & Identity Service Operations Manager > GÉANT > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAL8fbwMyV99aEzsb4Ej-HjaOowkiQ3HEqiPnYV6odm8TDu7DCg%40mail.gmail.com > . > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJeB3MMSf%3D8n9c1_G54iRUuAtftbASaik0CVjP0MRA9_9xWADg%40mail.gmail.com.
