mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Another big round of refactoring and cleaning...
This commit is contained in:
47
roles/sys-bkp-provider-user/tasks/main.yml
Normal file
47
roles/sys-bkp-provider-user/tasks/main.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
- name: create backup user
|
||||
user:
|
||||
name: backup
|
||||
create_home: yes
|
||||
when: run_once_backups_provider_user is not defined
|
||||
|
||||
- name: create .ssh directory
|
||||
file:
|
||||
path: /home/backup/.ssh
|
||||
state: directory
|
||||
owner: backup
|
||||
group: backup
|
||||
mode: '0700'
|
||||
when: run_once_backups_provider_user is not defined
|
||||
|
||||
- name: create /home/backup/.ssh/authorized_keys
|
||||
template:
|
||||
src: "authorized_keys.j2"
|
||||
dest: /home/backup/.ssh/authorized_keys
|
||||
owner: backup
|
||||
group: backup
|
||||
mode: '0644'
|
||||
when: run_once_backups_provider_user is not defined
|
||||
|
||||
- name: create /home/backup/ssh-wrapper.sh
|
||||
copy:
|
||||
src: "ssh-wrapper.sh"
|
||||
dest: /home/backup/ssh-wrapper.sh
|
||||
owner: backup
|
||||
group: backup
|
||||
mode: '0700'
|
||||
when: run_once_backups_provider_user is not defined
|
||||
|
||||
- name: grant backup sudo rights
|
||||
copy:
|
||||
src: "backup"
|
||||
dest: /etc/sudoers.d/backup
|
||||
mode: '0644'
|
||||
owner: root
|
||||
group: root
|
||||
notify: sshd restart
|
||||
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
|
Reference in New Issue
Block a user