This is easy to experiment with, by constructing a simple playbook:
- shell: echo {{ foo }}
with_items: [1,2,3,4,5]
register: result
- debug: var=result
You will see that the result variable does get registered as an array.
On Wed, Aug 20, 2014 at 7:53 AM, Imran Khan <[email protected]>
wrote:
> What I need is a register array!
>
>
> On Wednesday, August 20, 2014 4:48:17 AM UTC-7, Imran Khan wrote:
>
>> I would like to know that If I run a task in a loop and save the value in
>> a register, how can I save the values so that I have them accessible when I
>> need them
>> P.S: I am running my playbook using *serial: 1 .* So, when I iterate a
>> task, say 5 times, it should save them all seperately, so that when the
>> playbook runs serially the second or third time around, I can use the
>> registered values as needed.
>> Example:
>>
>> - hosts: just_created_clients
>> serial: 1
>> gather_facts: False
>>
>> #
>> #
>> tasks:
>> #
>> #
>> - name: Check if the changes to config_file were successful
>> shell: cat /home/imran/Desktop/tobefetched/config_file
>> with_sequence: count=5
>> register: my_content
>> ignore_errors: yes
>> #
>> #
>>
>>
>> Now, how do I access the values in the register(s) ? Note: I will not be
>> immediately using these values, so can't have a task immediately following
>> this task, which uses the results of this register sequentially. What I
>> need is a register array!
>>
> --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/abdb1d0d-05e1-4c1a-ba4e-f63a56ca56b0%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/abdb1d0d-05e1-4c1a-ba4e-f63a56ca56b0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgw03DqhcUMJFPtE%3Dvq%3Dh7geOmUYu9z1_xfYOESb-D1NfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.