-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajoute un rôle backup (surtout pour la bêta)
- Loading branch information
1 parent
8daf762
commit 8cb4aec
Showing
7 changed files
with
246 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
- name: install borg | ||
ansible.builtin.get_url: | ||
url: https://github.com/borgbackup/borg/releases/download/1.1.17/borg-linux64 | ||
dest: /usr/local/bin/borg | ||
mode: u=rwx,g=rx,o=rx | ||
|
||
- name: generate logrotate config file for backup logs | ||
ansible.builtin.template: | ||
src: "logrotate_zds-backup.j2" | ||
dest: "/etc/logrotate.d/zds-backup" | ||
mode: u=rw,g=r,o=r | ||
|
||
# On beta server: | ||
- name: create backup users on beta server | ||
ansible.builtin.user: | ||
name: "{{ item }}" | ||
home: "/home/{{ item }}" | ||
password: '!' # will do --disabled-password of adduser | ||
with_items: | ||
- zds-prod | ||
- zds-matomo | ||
when: env == "beta" | ||
|
||
- name: create .ssh folders for backup users on beta server | ||
ansible.builtin.file: | ||
path: "/home/{{ item }}/.ssh" | ||
state: directory | ||
owner: "{{ item }}" | ||
group: "{{ item }}" | ||
mode: u=rwx,g=,o= | ||
with_items: | ||
- zds-prod | ||
- zds-matomo | ||
when: env == "beta" | ||
|
||
- name: create .ssh/authorized_keys files for backup users on beta server | ||
ansible.builtin.file: | ||
path: "/home/{{ item }}/.ssh/authorized_keys" | ||
state: touch | ||
owner: "{{ item }}" | ||
group: "{{ item }}" | ||
mode: u=rw,g=,o= | ||
with_items: | ||
- zds-prod | ||
- zds-matomo | ||
when: env == "beta" | ||
|
||
- name: create backup cleaning script on beta server | ||
ansible.builtin.template: | ||
src: beta/cleaning.sh.j2 | ||
dest: /root/bin/backup_cleaning.sh | ||
mode: u=rwx,g=r,o= | ||
when: env == "beta" | ||
|
||
- name: create script to restore backup on beta server | ||
ansible.builtin.template: | ||
src: beta/restore-from-prod.sh.j2 | ||
dest: /root/bin/restore-from-prod.sh | ||
mode: u=rwx,g=r,o= | ||
when: env == "beta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
roles/backup/files/logrotate-zds-backup → .../backup/templates/logrotate_zds-backup.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/var/log/zds/backups*.log { | ||
{{ logdir }}/backups*.log { | ||
rotate 52 | ||
compress | ||
size 2M | ||
size 2M | ||
missingok | ||
notifempty | ||
delaycompress | ||
delaycompress | ||
} |