Files
it-ansible/playbooks/init_hetzer_vm.yaml
Julian Schacher a921224e56 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.
2023-11-24 12:59:40 +01:00

26 lines
623 B
YAML

---
- 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"