1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

random_string: Specify seed while generating random string (#10710)

* random_string: Specify seed while generating random string

* Allow user to specify seed to generate random string

Fixes: #5362

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Abhijeet Kasurde 2025-08-27 13:00:44 -07:00 committed by GitHub
parent ded43714d3
commit b5a2c5812c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 4 deletions

View file

@ -21,6 +21,8 @@
result11: "{{ query('community.general.random_string', base64=true, length=8) }}"
result12: "{{ query('community.general.random_string', upper=false, numbers=false, special=false) }}" # all lower case
result13: "{{ query('community.general.random_string', override_all='0', length=2) }}"
result14: "{{ query('community.general.random_string', seed='1234') }}"
result15: "{{ query('community.general.random_string', seed='1234') }}"
- name: Raise error when impossible constraints are provided
set_fact:
@ -51,3 +53,4 @@
- result13[0] == '00'
- impossible_result is failed
- "'Available characters cannot' in impossible_result.msg"
- result15[0] == result14[0]