mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-03-26 21:33:05 +00:00
ansible requires to either use "#!/bin/bash -eu" or "#!/bin/bash -eux" for bash shebangs.
30 lines
629 B
Bash
30 lines
629 B
Bash
#!/bin/bash -eu
|
|
|
|
NUM=${1-1000}
|
|
FILE="users.json"
|
|
date=$(date --date='+2 years' "+%Y-%m-%d %H:%M:%S")
|
|
|
|
echo "{" > "$FILE"
|
|
|
|
echo " \"users\": [" >> "$FILE"
|
|
|
|
for i in $(seq 1 "$NUM"); do
|
|
{
|
|
echo " {"
|
|
echo " \"name\": \"user$i\","
|
|
echo " \"first\": \"First $i\","
|
|
echo " \"last\": \"Last $i\","
|
|
echo " \"password\": \"user${i}PW\","
|
|
echo " \"passwordexpiration\": \"$date\""
|
|
} >> "$FILE"
|
|
if [ "$i" -lt "$NUM" ]; then
|
|
echo " }," >> "$FILE"
|
|
else
|
|
echo " }" >> "$FILE"
|
|
fi
|
|
done
|
|
|
|
echo " ]" >> "$FILE"
|
|
|
|
echo "}" >> "$FILE"
|