Commit ae95e67f authored by Jocelyn Delalande's avatar Jocelyn Delalande
Browse files

Use standard yaml syntax

parent 29d7b806
---
- name: backup folder exists
file: path="{{backup_destinations_backups_path}}"
state=directory
mode=0755
file:
path: "{{backup_destinations_backups_path}}"
state: directory
mode: 0755
---
- name: backup scripts folder exists in /opt
file: path="/opt/backup-scripts"
state=directory
recurse="yes"
owner="root"
group="root"
mode=0700
file:
path: "/opt/backup-scripts"
state: directory
recurse: "yes"
owner: "root"
group: "root"
mode: 0700
- name: folder used to store private ssh keys dedicated to backups is present
file: path="/root/.ssh/backups"
state=directory
recurse="yes"
owner="root"
group="root"
mode=0700
file:
path: "/root/.ssh/backups"
state: directory
recurse: "yes"
owner: "root"
group: "root"
mode: 0700
......@@ -2,34 +2,38 @@
# borgbackup is installed by "borgbackup" role
# /opt/backup-scripts is created by "backup-sources" role
- name: /opt/backup-scripts/borgbackup-client folder exists
file: path="/opt/backup-scripts/borgbackup-client"
state=directory
owner="root"
group="root"
mode=0700
file:
path: "/opt/backup-scripts/borgbackup-client"
state: directory
owner: "root"
group: "root"
mode: 0700
- name: backup script is installed
template: src="borgbackup-client.sh.j2"
dest="/opt/backup-scripts/borgbackup-client/{{item.remote_server}}_{{item.repository_name}}.sh"
owner="root"
group="root"
mode=0700
template:
src: "borgbackup-client.sh.j2"
dest: "/opt/backup-scripts/borgbackup-client/{{item.remote_server}}_{{item.repository_name}}.sh"
owner: "root"
group: "root"
mode: 0700
with_items: "{{backup_sources.borgbackup_clients}}"
- name: check/repair script is installed
template: src="check-repair-borgbackup-repository.sh.j2"
dest="/opt/backup-scripts/borgbackup-client/check-repair-{{item.remote_server}}_{{item.repository_name}}.sh"
owner="root"
group="root"
mode=0700
template:
src: "check-repair-borgbackup-repository.sh.j2"
dest: "/opt/backup-scripts/borgbackup-client/check-repair-{{item.remote_server}}_{{item.repository_name}}.sh"
owner: "root"
group: "root"
mode: 0700
with_items: "{{backup_sources.borgbackup_clients}}"
- name: postgresql dump script is installed
template: src="postgresql-dump.sh.j2"
dest="/opt/backup-scripts/borgbackup-client/postgresql-dump.sh"
owner="root"
group="root"
mode=0700
template:
src: "postgresql-dump.sh.j2"
dest: "/opt/backup-scripts/borgbackup-client/postgresql-dump.sh"
owner: "root"
group: "root"
mode: 0700
with_items: "{{backup_sources.borgbackup_clients}}"
- name: remote servers ssh fingerprints are installed
......@@ -39,21 +43,24 @@
with_items: "{{backup_sources.borgbackup_clients}}"
- name: folder used to store private ssh keys is present
file: path="{{borgbackup_client_ssh_keys_folder_path}}"
recurse="yes"
owner="root"
group="root"
mode=0700
file:
path: "{{borgbackup_client_ssh_keys_folder_path}}"
recurse: "yes"
owner: "root"
group: "root"
mode: 0700
- name: ssh keys are installed
copy: content="{{item.private_ssh_key}}"
dest="{{borgbackup_client_ssh_keys_folder_path}}/{{item.remote_server}}_{{item.repository_name}}_rsa"
owner="root"
group="root"
mode=0600
copy:
content: "{{item.private_ssh_key}}"
dest: "{{borgbackup_client_ssh_keys_folder_path}}/{{item.remote_server}}_{{item.repository_name}}_rsa"
owner: "root"
group: "root"
mode: 0600
with_items: "{{backup_sources.borgbackup_clients}}"
- debug: msg="month:{% if item.when is defined %}{{ item.when.month | default(borgbackup_client_defaults.when.month) }}{% else %}{{ borgbackup_client_defaults.when.month }}{% endif %}"
- debug:
msg: "month:{% if item.when is defined %}{{ item.when.month | default(borgbackup_client_defaults.when.month) }}{% else %}{{ borgbackup_client_defaults.when.month }}{% endif %}"
with_items: "{{ backup_sources.borgbackup_clients }}"
- name: cron job is installed
......
......@@ -3,22 +3,26 @@
# backup_destinations_backups_path folder is created by "backup-destinations" role
- name: backup unix user exists
user: name="{{item.hostname}}"
state=present
shell=/bin/bash
home="{{backup_destinations_backups_path}}/{{item.hostname}}"
user:
name: "{{item.hostname}}"
state: present
shell: /bin/bash
home: "{{backup_destinations_backups_path}}/{{item.hostname}}"
with_items: "{{backup_destinations.borgbackup_server_clients}}"
- name: repository folder exists
file: path="{{backup_destinations_backups_path}}/{{item.hostname}}/borgbackup-repos"
state=directory
mode=0700
owner="{{item.hostname}}"
group="{{item.hostname}}"
file:
path: "{{backup_destinations_backups_path}}/{{item.hostname}}/borgbackup-repos"
state: directory
mode: 0700
owner: "{{item.hostname}}"
group: "{{item.hostname}}"
with_items: "{{backup_destinations.borgbackup_server_clients}}"
- name: client ssh keys are installed
authorized_key: key="{{item.ssh_public_key}}"
user="{{item.hostname}}"
key_options='command="cd {{backup_destinations_backups_path}}/{{item.hostname}}/borgbackup-repos; borg serve --restrict-to-path {{backup_destinations_backups_path}}/{{item.hostname}}/borgbackup-repos",no-port-forwarding,no-X11-forwarding,no-pty,no-agent-forwarding,no-user-rc'
authorized_key:
key: "{{item.ssh_public_key}}"
user: "{{item.hostname}}"
key_options:
'command: "cd {{backup_destinations_backups_path}}/{{item.hostname}}/borgbackup-repos; borg serve --restrict-to-path {{backup_destinations_backups_path}}/{{item.hostname}}/borgbackup-repos",no-port-forwarding,no-X11-forwarding,no-pty,no-agent-forwarding,no-user-rc'
with_items: "{{backup_destinations.borgbackup_server_clients}}"
---
- name: Activate backports
apt_repository: repo='deb http://ftp.debian.org/debian {{ ansible_distribution_release }}-backports main'
filename="{{ ansible_distribution_release }}-backports"
update_cache="yes"
state="present"
apt_repository:
repo: 'deb http://ftp.debian.org/debian {{ ansible_distribution_release }}-backports main'
filename: "{{ ansible_distribution_release }}-backports"
update_cache: "yes"
state: "present"
when: ansible_distribution_release is defined and ansible_distribution_release != "NA"
- name: borgbackup is installed (from backports)
apt: name=borgbackup
state=latest
update_cache=yes
default_release="{{ ansible_distribution_release }}-backports"
apt:
name: borgbackup
state: latest
update_cache: yes
default_release: "{{ ansible_distribution_release }}-backports"
when: ansible_distribution_release is defined and ansible_distribution_release != "NA"
- name: borgbackup is installed (not from backports)
apt: name=borgbackup
state=latest
update_cache=yes
apt:
name: borgbackup
state: latest
update_cache: yes
when: ansible_distribution_release is not defined or ansible_distribution_release == "NA"
- name: fuse is installed (borg umount needs fusermount)
apt: name=fuse
state=present
update_cache=yes
apt:
name: fuse
state: present
update_cache: yes
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment