Files
ansible-freeipa/tests/user/generate_test_data.yml
Thomas Woerner 907650c746 tests/user/test_users_present_*: Use new generate_test_data.yml
The new generate_test_data.yml is creating the test data with
ansible.builtin.shell and is not calling shell scripts any more. The
generation in the yml file and also the set_fact calls make sure that
the test data is used.
2024-10-11 15:51:14 +02:00

49 lines
1.2 KiB
YAML

# Generate lists for users
---
- name: Create present services.json data
ansible.builtin.shell: |
date=$(date --date='+2 years' "+%Y-%m-%d %H:%M:%S")
echo "["
for i in $(seq -w 1 "{{ NUM }}"); do
echo " {"
echo " \"name\": \"testuser_${i}\","
echo " \"first\": \"First ${i}\","
echo " \"last\": \"Last ${i}\","
echo " \"password\": \"user${i}PW\","
echo " \"passwordexpiration\": \"${date}\""
if [ "$i" -lt "{{ NUM }}" ]; then
echo " },"
else
echo " }"
fi
done
echo "]"
vars:
NUM: 500
register: command
- name: Set user_list
ansible.builtin.set_fact:
user_list: "{{ command.stdout | from_json }}"
- name: Create absent user.json data
ansible.builtin.shell: |
echo "["
for i in $(seq -w 1 "{{ NUM }}"); do
echo " {"
echo " \"name\": \"testuser_${i}\""
if [ "$i" -lt "{{ NUM }}" ]; then
echo " },"
else
echo " }"
fi
done
echo "]"
vars:
NUM: 500
register: command
- name: Set user_absent_list
ansible.builtin.set_fact:
user_absent_list: "{{ command.stdout | from_json }}"