mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-03-26 21:33:05 +00:00
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.
49 lines
1.2 KiB
YAML
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 }}"
|