Skip to content

Add VS Code tasks to create Linux user and add SSH keys

The glplex script can be used to add SSH keys to the hosts, but running it in the container will only add the keys to the service account Linux user, which has a long numerical name that's awkward to use and difficult to remember.

I'd rather have a short username, such as my initials mjl, instead of sa_104481838115385290889 or mlockhart_gitlab_com anyway.

I can write an Ansible playbook which will use the dynamic inventory for GET hosts, to:

  1. create a user (the name can be in a new configuration variable)
  2. Copy the public keys from gitlab.com into this user's ~/.ssh/authorized-keys (idempotently)
  3. Create SSH configuration for the host, so that I can SSH into it from within the container

In addition to having a nice, short username, this will also solve the problem where I currently must SSH from outside the GET container. Though it does mean I'll need to add the SSH secret key to the container, and Start SSH agent inside container (#15 - closed).

Edited by Mike Lockhart | GitLab