2021-01-10 20:35:37 +01:00
|
|
|
- name: create backup user
|
|
|
|
user:
|
|
|
|
name: backup
|
|
|
|
create_home: yes
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_backups_provider_user is not defined
|
2021-01-10 20:35:37 +01:00
|
|
|
|
|
|
|
- name: create .ssh directory
|
|
|
|
file:
|
|
|
|
path: /home/backup/.ssh
|
|
|
|
state: directory
|
|
|
|
owner: backup
|
|
|
|
group: backup
|
|
|
|
mode: '0700'
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_backups_provider_user is not defined
|
2021-01-10 20:35:37 +01:00
|
|
|
|
|
|
|
- name: create /home/backup/.ssh/authorized_keys
|
|
|
|
template:
|
|
|
|
src: "authorized_keys.j2"
|
|
|
|
dest: /home/backup/.ssh/authorized_keys
|
|
|
|
owner: backup
|
|
|
|
group: backup
|
|
|
|
mode: '0644'
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_backups_provider_user is not defined
|
2021-01-10 20:35:37 +01:00
|
|
|
|
2021-01-11 14:14:36 +01:00
|
|
|
- name: create /home/backup/ssh-wrapper.sh
|
2023-04-19 13:36:19 +02:00
|
|
|
copy:
|
|
|
|
src: "ssh-wrapper.sh"
|
2021-01-11 14:14:36 +01:00
|
|
|
dest: /home/backup/ssh-wrapper.sh
|
|
|
|
owner: backup
|
|
|
|
group: backup
|
|
|
|
mode: '0700'
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_backups_provider_user is not defined
|
2021-01-11 14:14:36 +01:00
|
|
|
|
|
|
|
- name: grant backup sudo rights
|
2021-01-10 20:35:37 +01:00
|
|
|
copy:
|
|
|
|
src: "backup"
|
|
|
|
dest: /etc/sudoers.d/backup
|
|
|
|
mode: '0644'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
notify: sshd restart
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_backups_provider_user is not defined
|
|
|
|
|
|
|
|
- name: run the backups_provider_user tasks once
|
|
|
|
set_fact:
|
|
|
|
run_once_backups_provider_user: true
|
|
|
|
when: run_once_backups_provider_user is not defined
|