mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #8827/afd754e3 backport][stable-9] (doc) random_string lookup: fix examples (#8842)
(doc) random_string lookup: fix examples (#8827)
(cherry picked from commit afd754e384
)
Co-authored-by: Samuel-BF <36996277+Samuel-BF@users.noreply.github.com>
This commit is contained in:
parent
6fec5a7005
commit
1978100d25
1 changed files with 7 additions and 7 deletions
|
@ -104,37 +104,37 @@ EXAMPLES = r"""
|
||||||
- name: Generate random string
|
- name: Generate random string
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
var: lookup('community.general.random_string')
|
var: lookup('community.general.random_string')
|
||||||
# Example result: ['DeadBeeF']
|
# Example result: 'DeadBeeF'
|
||||||
|
|
||||||
- name: Generate random string with length 12
|
- name: Generate random string with length 12
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
var: lookup('community.general.random_string', length=12)
|
var: lookup('community.general.random_string', length=12)
|
||||||
# Example result: ['Uan0hUiX5kVG']
|
# Example result: 'Uan0hUiX5kVG'
|
||||||
|
|
||||||
- name: Generate base64 encoded random string
|
- name: Generate base64 encoded random string
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
var: lookup('community.general.random_string', base64=True)
|
var: lookup('community.general.random_string', base64=True)
|
||||||
# Example result: ['NHZ6eWN5Qk0=']
|
# Example result: 'NHZ6eWN5Qk0='
|
||||||
|
|
||||||
- name: Generate a random string with 1 lower, 1 upper, 1 number and 1 special char (at least)
|
- name: Generate a random string with 1 lower, 1 upper, 1 number and 1 special char (at least)
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
var: lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1)
|
var: lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1)
|
||||||
# Example result: ['&Qw2|E[-']
|
# Example result: '&Qw2|E[-'
|
||||||
|
|
||||||
- name: Generate a random string with all lower case characters
|
- name: Generate a random string with all lower case characters
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: query('community.general.random_string', upper=false, numbers=false, special=false)
|
var: query('community.general.random_string', upper=false, numbers=false, special=false)
|
||||||
# Example result: ['exolxzyz']
|
# Example result: ['exolxzyz']
|
||||||
|
|
||||||
- name: Generate random hexadecimal string
|
- name: Generate random hexadecimal string
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: query('community.general.random_string', upper=false, lower=false, override_special=hex_chars, numbers=false)
|
var: query('community.general.random_string', upper=false, lower=false, override_special=hex_chars, numbers=false)
|
||||||
vars:
|
vars:
|
||||||
hex_chars: '0123456789ABCDEF'
|
hex_chars: '0123456789ABCDEF'
|
||||||
# Example result: ['D2A40737']
|
# Example result: ['D2A40737']
|
||||||
|
|
||||||
- name: Generate random hexadecimal string with override_all
|
- name: Generate random hexadecimal string with override_all
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: query('community.general.random_string', override_all=hex_chars)
|
var: query('community.general.random_string', override_all=hex_chars)
|
||||||
vars:
|
vars:
|
||||||
hex_chars: '0123456789ABCDEF'
|
hex_chars: '0123456789ABCDEF'
|
||||||
|
|
Loading…
Reference in a new issue