I am getting user input for a password in my Ansible task. This user input is passed through command to 'password variable'. I want to check if given password matches below condition:
- length greater than 8
- password should contain only printable ASCII chars
I tried something like this :
- fail: msg="Password validation failed"
when: password | default('') | length <= 0 | chars = ascii_letters
This is not working.
If I am using fail module only for password non empty and length check, it is working.
- fail: msg="Password validation failed"
when: password | default('') | length <= 0 | chars = ascii_letters