
Hello,
thank you very much to everyone who took part in this discussion!
I got a very interesting insight!
@Jeremy: The ansible approach is fabulous! My team plans to go the ansible way for various automation and configuration tasks! So this is a good perspective for the future! And with your link to the ansible file I am prepared for the change to come... :-) Also the remark on using the venv installed binaries, libraries etc. from outside is very helpful.
@Stephen: Thank you for your warning! I will keep it in mind while doing such kind of operations from outside the environment. (I am familiar with the shell and shell variables like PATH, LIBRARY_PATH etc...so I hope I can get along... :-))
Your comments on my curl-command are right and this is due to my "anonymization"-effort:
Is this a viable curl-call to create a user?: curl -X POST -u 'admin-user:<password>' -H "Content-Type: application/json" -d '{ "email": "peter.rabbit@example.org", "display_name": "Peter Rabbit", "password": "secret" }' http://localhost:8001/3.1/users
The "admin-user" in this command is the "restadmin" user, not the list-owner. I think in the 'create-list' command you meant the --admin-user to be the list owner. Also, the "password" attribute is not very useful in Mailman 3. The only authorized user of the REST API is the restadmin user. There is no provision for access by other users. To authenticate other users, I should have used the alias "restadmin" and the password "restadmin-password" for the "-u"-parameter to be more precise...so the curl-call should look like this:
curl -X POST -u 'restadmin:restadmin-password' -H "Content-Type: application/json" -d '{ "email": "peter.rabbit@example.org", "display_name": "Peter Rabbit", "password": "secret" }' http://localhost:8001/3.1/users
And for describing the call of my high-level script I should have used: ./create-list --listname myfirst.list@lists.example.org --owner-email peter.rabbit@example.org [--owner-name "Peter Rabbit"]
Using python...I think your suggestion:
However, in production, you would most likely use "mailman shell -r script". is the recommended way according to the docs here: https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/commands/do...
Once again: Thank you very much to everyone for this enlightening and helpful discussion!
Kind regards
Chris