gigascience / gigadb-website

Source code for running GigaDB
http://gigadb.org
GNU General Public License v3.0
9 stars 14 forks source link

Update bastion user provisioning play to generate AWS credentials files #1394

Closed rija closed 5 months ago

rija commented 1 year ago

User story

As a curator I want the tools on bastion to allow me to perform files operations on Wasabi with rclone So that I can manage the dataset files on Wasabi

Acceptance criteria

Given a new user needs a system account on bastion When we run the provisioning script for creating new user with username parameter "lily" Then a bastion user account is created for "lily" And SSH public keys are added to the authorised keys And an AWS credential file is created in the bastion user's home directory with placeholder values

Given an existing user has an account on bastion And there is no AWS credential file for the Wasabi sub-user in the bastion user's home directory When we run the provisioning script for creating new user with username parameter "lily" And an AWS credential file is created in the bastion user's home directory with placeholder values

Given an existing user has an account on bastion And there is AWS credential file for the Wasabi sub-user in the bastion user's home directory When we run the provisioning script for creating new user with username parameter "lily" Then nothing change

Additional Info

Default location for the AWS credential files: ~/.aws/credentials

Use:

* https://docs.aws.amazon.com/cli/latest/reference/iam/create-role.html * https://docs.aws.amazon.com/cli/latest/reference/iam/create-access-key.html

Nice to have:

* https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_admin-change-user.html#Using_ManagingPasswordsAPI * https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html#id_users_create_cliwpsapi

AWS Credentials template (as ops/configuration/aws/credentials.j2)

[default]
aws_access_key_id=\<Writte your Wasabi access keys Id here\>
aws_secret_access_key=\<Write your Wasabi secret access key here\>

We assume that API keys created manually for now using the Wasabi dashboard. The API keys will need to be save in the Gitlab Variables.

 ansible-playbook -i ../../inventories users_playbook.yml -e "newuser=lily" -e "wasabi_access_key_id=xxxxxxx" -e "wasabi_secret_access_key=yyyyyy"

or parse the API keys CSV directly from the play (use https://docs.ansible.com/ansible/latest/collections/community/general/read_csv_module.html)

Product Backlog Item Ready Checklist

Product Backlog Item Done Checklist

rija commented 6 months ago
rija commented 5 months ago

implemented in PR #1781