Hi, I just want to
Ex:
hosts: dev
tasks:
- name: get variable
shell: some command
register: out1 # i want to use stdout_lines of these out1 in my next
task
- name: export
shell: command {{item}}
register: out2 # i want to use stdout kines of each item in my next
task
with_items: "{{out1.stdout_lines}}"
#After this I tried to combine out1 as key and out2 as value to the key,
But I am getting error
- set_fact:
my_env: "{{my_env | default ({}) | combine ({{item.0}}: {{item.1}})}}"
with_nested:
- "{{out1.stdout_lines}}"
- "{{out2 | json_query('results[*].stdout_lines}}"
On Mon, 24 Feb 2020, 19:12 Dick Visser, <[email protected]> wrote:
> Hi Sivaraman
>
> Could you please state clearly:
>
> - What goal you are trying to achieve.
> - How you are doing this.
> - What problems you encounter.
> - Which command did you run, and what actual output did you get from
> that (copied as plain text - not as images, attachments, or
> screenshots)
> - What the relevant tasks/playbooks/code/variables look like.
>
>
>
> On Mon, 24 Feb 2020 at 14:07, Sivaraman P <[email protected]> wrote:
> >
> > I have list of items to be executed in the command and I have to save
> the result in stdout for each item to the same item.
> >
> > Ex:
> > hosts: dev
> > tasks:
> > - name: get variable
> > shell: cat file #this file contain the list of items that I need to
> run the command
> > register: out1
> >
> > - name: export
> > shell: command {{item}}
> > register: out2 #This contains results of each item from out1.
> > with_items: "{{out1.stdout_lines}}"
> >
> > The question is I have to get the stdout of each item result and I have
> to store as value for that item.
> >
> > --
> > 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/16eb196f-324c-4944-ac21-94c1a0b98e75%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/CAL8fbwMvo6%2BF0ZJJNgDO3UNjTCw6d%3D4jFRDncHFvpn19MkcXAg%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/CAHS7Q%2BvOU-tkbKtFVGgt5YeY%2BQb4y7dXxVKwJOH6_YjOFZoR-g%40mail.gmail.com.