you are overwriting the variables on each loop, and then you are NOT
looping the shell action.  Remove the set fact and use the lookups and
loop directly on the shell action.

On Thu, Mar 21, 2019 at 6:00 AM Jakub Kafka <[email protected]> wrote:
>
> Thanks, thats work, bud i have another problem. Here is my code. If i loop 
> more than 2, how can i these 2(and more) results, pass to file. it only pass 
> 1.
>
> - gather_facts: false
>   hosts: localhost
>   tasks:
>     - set_fact:
>         db: "{{ lookup('password', '/dev/null chars=ascii_letters,digits 
> length=32') }}"
>         usr: "{{ lookup('password', '/dev/null chars=ascii_letters,digits 
> length=39') }}"
>         password: "{{ lookup('password', '/dev/null 
> chars=ascii_letters,digits length=21') + '' }}"
>       with_sequence: end={{ number }}
>     - local_action: shell echo "{{ db }}__{{ usr }} {{ db }} {{ password }}" 
> >> /tmp/pass_pokus3
>
>
>
>
>
>
>
>
> Dne středa 20. března 2019 17:16:29 UTC+1 Kai Stian Olstad napsal(a):
>>
>> On 20.03.2019 15:30, Jakub Kafka wrote:
>> > i have question. Can i specify number of loops from command line
>> > --extra_vars? II want specify number of password to be generated.
>>
>> Of course, with variables you can do almost everyting.
>>
>>   - debug: var=item
>>     with_sequence: end={{ number }}
>>
>>
>> ansible-playbook -e number=3
>>
>>
>> --
>> Kai Stian Olstad
>
> --
> 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/8d132c6f-b357-4470-bd60-8cbc2edda221%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
----------
Brian Coca

-- 
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/CACVha7eHRN%2BmWqoN6WE2VL%2BAhnGT3GiiUj%3Da9hWV_KDtQm6O7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to