2021-10-27 22:37:28 +02:00
|
|
|
|
---
|
2022-08-05 20:16:36 +02:00
|
|
|
|
# Copyright (c) Ansible Project
|
|
|
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
2021-10-27 22:37:28 +02:00
|
|
|
|
- hosts: localhost
|
|
|
|
|
gather_facts: false
|
|
|
|
|
tasks:
|
|
|
|
|
- name: Call random_words plugin
|
|
|
|
|
set_fact:
|
|
|
|
|
result1: "{{ query('community.general.random_words') }}"
|
|
|
|
|
result2: "{{ query('community.general.random_words', min_length=5, max_length=5) }}"
|
|
|
|
|
result3: "{{ query('community.general.random_words', delimiter='!') }}"
|
|
|
|
|
result4: "{{ query('community.general.random_words', numwords=3, delimiter='-', case='capitalize') }}"
|
2021-10-30 10:58:01 +02:00
|
|
|
|
result5: "{{ query('community.general.random_words', min_length=5, max_length=5, numwords=3, delimiter='') }}"
|
2021-10-27 22:37:28 +02:00
|
|
|
|
|
|
|
|
|
- name: Check results
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- result1 | length == 1
|
|
|
|
|
- result1[0] | length >= 35
|
|
|
|
|
- result2 | length == 1
|
|
|
|
|
- result2[0] | length == 35
|
|
|
|
|
- result3 | length == 1
|
|
|
|
|
- result3[0].count("!") == 5
|
|
|
|
|
- result4 | length == 1
|
|
|
|
|
- result4[0] | length >= 17
|
|
|
|
|
- result4[0] | length <= 29
|
|
|
|
|
- result4[0] | regex_findall("[A-Z]") | length == 3
|
|
|
|
|
- result4[0].count("-") == 2
|
|
|
|
|
- result5 | length == 1
|
2021-10-30 10:58:01 +02:00
|
|
|
|
- result5[0] | length == 15
|