commit inicial

This commit is contained in:
Mauro Torrez 2019-05-25 20:51:38 -03:00
parent cad93a1a6e
commit 7ca7e63add
3 changed files with 57 additions and 0 deletions

12
defaults/main.yml Normal file
View File

@ -0,0 +1,12 @@
---
# usuario borg
borg_user: borg
# home borg
borg_home: "/srv/borg"
# nombre del repositorio
borg_repo_name: "backup"
# path real del repositorio
borg_repo_path: "{{ borg_home }}/{{ borg_repo_name }}"

3
handlers/main.yml Normal file
View File

@ -0,0 +1,3 @@
---
- name: restart ssh
service: name=ssh state=restarted

42
tasks/main.yml Normal file
View File

@ -0,0 +1,42 @@
---
- name: instalar borg
apt:
name: borgbackup
state: present
- name: crear usuario borg
user:
name: "{{ borg_user }}"
home: "{{ borg_home }}"
shell: /bin/bash
system: yes
- name: crear directorio {{ borg_repo_path }}
file:
path: "{{ borg_repo_path }}"
owner: "{{ borg_user }}"
state: directory
recurse: yes
- name: crear enlace {{ borg_home }}/{{ borg_repo_name }}
when: borg_repo_path != (borg_home+'/'+borg_repo_name)
file:
path: "{{ borg_home }}/{{ borg_repo_name }}"
src: "{{ borg_repo_path }}"
owner: "{{ borg_user }}"
state: link
- name: crear directorio .ssh para borg
file:
path: "{{ borg_home }}/.ssh"
owner: "{{ borg_user }}"
state: directory
mode: go-rwx
- name: permitir login root
when: borg_user == "root"
lineinfile:
name: "/etc/ssh/sshd_config"
state: "absent"
regexp: '^\s*PermitRootLogin\s+no'
notify: restart ssh