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 <[email protected]> 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 [email protected].
> 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 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/CAFwWkHrR1Lf4K0MeEE807_me3758YMYmB7OoQ%2B9eeU2DCAgX1w%40mail.gmail.com.