Add playbook for the initial basic deployment of a Hetzner VM
This playbook does the following: - Creates a cit user (which has root privileges) using the cit_user role. - Sets the cit users ssh authorized_keys to the authorized_keys of the root user.
This commit is contained in:
25
playbooks/init_hetzer_vm.yaml
Normal file
25
playbooks/init_hetzer_vm.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: Ensure cit user
|
||||
hosts: all
|
||||
roles:
|
||||
- cit_user
|
||||
|
||||
- name: Set the authorized_keys of the cit user to the authorized_keys of the root user
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Ensure cit user .ssh directory
|
||||
ansible.builtin.file:
|
||||
path: /home/cit/.ssh
|
||||
state: directory
|
||||
owner: cit
|
||||
group: cit
|
||||
mode: "0700"
|
||||
|
||||
- name: Copy the root users authorized_keys for the cit user
|
||||
ansible.builtin.copy:
|
||||
src: /root/.ssh/authorized_keys
|
||||
remote_src: true
|
||||
dest: /home/cit/.ssh/authorized_keys
|
||||
owner: cit
|
||||
group: cit
|
||||
mode: "0600"
|
||||
Reference in New Issue
Block a user