Closed pierrepo closed 2 years ago
Example for user creation:
ansible-playbook students-create.yml -i hosts -u ubuntu -e @users-config.yml -e "studentdef=student-accounts.csv"
where student-accounts.csv
is a CSV-formated file:
login,password,group
stu-megm1-01,fera4+BARE7=,megm1
stu-megm1-02,tysy9@TETE5+,megm1
stu-megm1-03,xazy5+VAZA2-,megm1
stu-megm1-04,vaze6-XEBA4=,megm1
stu-megm1-05,tyny6+VETA3@,megm1
stu-megm1-06,bysa5+ZYKE2+,megm1
To delete users, we use the students-delete.yml
playbook:
ansible-playbook students-remove.yml -i hosts -u ubuntu -e "studentdef=student-accounts.csv"
Thanks @pierrepo, looking good :+1:
We should also add that to the documentation for visibility.
Thanks @jtpio Can you please take care of the documentation part?
@pierrepo do you have an example CSV file that we could use for the docs?
@jtpio sure. This one for instance:
login,password,group
stu-megm1-01,bn3r7RjtOyg15X,megm1
stu-megm1-02,2shgP3xK7aTuMN,megm1
stu-megm1-03,Kh5jn4GuEIFIzY,megm1
stu-megm1-04,g9gBHQjJ4VqQG1,megm1
stu-megm1-05,73O88oFb6B1TB0,megm1
stu-megm1-06,laZubrmgKBNg1x,megm1
stu-megm1-07,gAONEMsgdz28si,megm1
stu-megm1-08,tjlGadyELWj59M,megm1
stu-megm1-09,soIb4txJDPjo1d,megm1
stu-megm1-10,QjhalcW9Uq5wxo,megm1
Accounts for 10 students of group megm1
with randomly-generated passwords. It could be worth mentioning somewhere that passwords should not contain a comma, since comma is the field separator for CSV files.
@pierrepo if you want to review the changes on ReadTheDocs: https://plasmabio--199.org.readthedocs.build/en/199/configuration/batch-users.html
I added some documentation in the Configuring
section to avoid creating a new top-level entry in the navigation bar.
There is a link at the bottom of the user creation page in the installation guide to point to the new page, for those who want to follow-up: https://plasmabio--199.org.readthedocs.build/en/199/install/users.html#creating-user-in-batches
Thanks @jtpio this looks very nice.
Maybe we should add somewhere that we can user extra parameters (disk quota for instance) when we create users:
ansible-playbook student-create.yml -u ubuntu -e "studentdef=students.csv" -e @students-config.yml
with students-config.yml
being:
# default quotas for students
quota:
soft: 200G
hard: 250G
Sounds good, just added the following note to the docs:
This is all good for me. Thanks @jtpio
Alright thanks @pierrepo for the review!
This PR handles issue #197