I looked at that, but we want to vary the length of the password each time
this is run.

On Tue, Apr 18, 2023 at 12:30 PM Abhijeet Kasurde <akasu...@redhat.com>
wrote:

> Have you tried -
>
> - name: Generate random string with length 12
>   ansible.builtin.debug:
>     var: lookup('community.general.random_string', length=12)
>
>
>  # Example result: ['Uan0hUiX5kVG']
>
> On Tue, Apr 18, 2023 at 7:40 AM Kathy L <lyonsf...@gmail.com> wrote:
>
>> Currently we are using pwgen to generate our random length passwords, but
>> we would like to use an Ansible module to make things easier.  What I have
>> is not working -
>>
>> set_fact:
>>   user_password:  "{{ lookup('ansible.builtin.password',
>> chars=['ascii_letters', 'digits'], length = {{ range(8-12)|random }} ) }}"
>>
>> Of course it does not like a variable within a variable.  Is there
>> another way to do this with an Ansible module that I am missing?
>>
>> --
>> 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 ansible-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/51262064-7d5e-493a-a615-71cd3a0362e6n%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/51262064-7d5e-493a-a615-71cd3a0362e6n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Thanks,
> Abhijeet Kasurde
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/jcj1d_cfNEc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFwWkHrR1Lf4K0MeEE807_me3758YMYmB7OoQ%2B9eeU2DCAgX1w%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAFwWkHrR1Lf4K0MeEE807_me3758YMYmB7OoQ%2B9eeU2DCAgX1w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAK9%2BsMec3oGx-qqRBDfDPy2FHD%3Dmuxe-e1-58w5-QCLdDJ4S1w%40mail.gmail.com.

Reply via email to