Hi,
Why not use a “map” of choice that you need instead use a double when with double variable?
Something like
criptography_map:
A: 32
B: 32
C: 32
D: 16
E: 16
And then in task
- name: Encoded random password
ansible.builtin.set_fact:
password: "{{ lookup('community.general.random_string', base64=true, length=criptography_map[chosen_encryption] ) }}"
no_log: true
This will be much simple, will not use 2 tasks and avoid usage of 2 different variables.