I believe this is roughly what you want:
{{ lookup('ansible.builtin.password', '/dev/null', chars=['ascii_letters',
'digits'], length=range(8, 12)|random) }}
1. You cannot nest {{ }}
2. Instead of `range(8-12)` I think you want `range(8, 13)`. First you
want a comma, and then range is non-inclus
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
wrote:
> Have you tried -
>
> - name: Generate random string with length 12
> ansible.builtin.debug:
> var: lookup('community.general.random_string', le
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 wrote:
> Currently we are using pwgen to generate our random length
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)|ra