Skip to content
Snippets Groups Projects
Verified Commit b106621f authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

Add SSH key to user

parent 93510d8d
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@ A -- very simple -- Ansible playbook that adds a new local user to `utility[\d+]
Example usage of this playbook:
```
ansible-playbook -i 127.0.0.1, playbook.yml -e "username=$USERNAME" -e "full_name=$YOUR_NAME" -k
ansible-playbook -i 127.0.0.1, playbook.yml -e "username=$USERNAME" -e "full_name=$YOUR_NAME" -e "ssh_key_path=$YOUR_SSH_KEY" -k
```
Remember to fill in the variables `$USERNAME` and `$YOUR_NAME`
Remember to fill in the variables `$USERNAME`, `$YOUR_NAME`, and `$YOUR_SSH_KEY`.
......@@ -4,11 +4,15 @@
comment: "{{ full_name }}"
groups: sudo
append: yes
# generate_ssh_key: yes
# ssh_key_bits: 4096
# ssh_key_comment: "{{ username }}'s key"
password: '!' # Do not allow login with a password
password_lock: yes # Login with SSH key only
register: user_output
- name: Add SSH key to user for logging in
ansible.posix.authorized_key:
user: "{{ username }}"
key: "{{ ssh_key_path }}"
- name: Create new VM for development
ansible.builtin.debug:
msg: "Now, provision a new VM using Terraform"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment