From 74871c1ea8b68c56f580b21f4d50ab9c0594d6cd Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sun, 28 Nov 2021 17:09:16 +0100 Subject: [PATCH 1/3] rsyslog: move variables in playbook --- group_vars/all/vars.yml | 5 ----- host_vars/log.adm.auro.re.yml | 10 ---------- playbooks/rsyslog.yml | 18 +++++++++++++++++- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index 2f5c748..c55389d 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -102,9 +102,4 @@ borg_backup_exclude: borg_encryption_passphrase: "{{ vault_borg_encryption_passphrase }}" borg_server_host: 10.128.0.4 - -rsyslog_outputs: - - proto: relp - address: 10.128.0.241 - port: 20514 ... diff --git a/host_vars/log.adm.auro.re.yml b/host_vars/log.adm.auro.re.yml index f088784..675fe4e 100644 --- a/host_vars/log.adm.auro.re.yml +++ b/host_vars/log.adm.auro.re.yml @@ -3,14 +3,4 @@ borg_backup_directories: - "/etc/" - "/var/" borg_backup_exclude: [] - -rsyslog_collector_base_dir: /var/log/remote -rsyslog_inputs: - - proto: relp - port: 20514 - - proto: udp - port: 514 - - proto: tcp - port: 6514 -rsyslog_outputs: [] ... diff --git a/playbooks/rsyslog.yml b/playbooks/rsyslog.yml index b37e4d5..0bb170f 100755 --- a/playbooks/rsyslog.yml +++ b/playbooks/rsyslog.yml @@ -1,10 +1,26 @@ #!/usr/bin/env ansible-playbook --- - hosts: log.adm.auro.re + vars: + rsyslog_collector_base_dir: /var/log/remote + rsyslog_inputs: + - proto: relp + port: 20514 + - proto: udp + port: 514 + - proto: tcp + port: 6514 + rsyslog_outputs: [] roles: + - rsyslog_common - rsyslog_collector -- hosts: all,!unifi +- hosts: all,!log.adm.auro.re,!unifi + vars: + rsyslog_outputs: + - proto: relp + address: 10.128.0.241 + port: 20514 roles: - rsyslog_common ... -- 2.45.2 From fa237cdea3e643f3326284454005be9ddf335afb Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sun, 28 Nov 2021 17:27:41 +0100 Subject: [PATCH 2/3] borgbackups: move variables in playbook --- group_vars/all/vars.yml | 15 ------ host_vars/caradoc.adm.auro.re.yml | 12 ----- host_vars/log.adm.auro.re.yml | 6 --- host_vars/perceval.adm.auro.re.yml | 3 -- playbooks/borgbackup.yml | 66 +++++++++++++++++++++-- roles/borgbackup_client/defaults/main.yml | 6 +-- 6 files changed, 66 insertions(+), 42 deletions(-) delete mode 100644 host_vars/caradoc.adm.auro.re.yml delete mode 100644 host_vars/log.adm.auro.re.yml delete mode 100644 host_vars/perceval.adm.auro.re.yml diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index c55389d..59e4ae5 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -87,19 +87,4 @@ apartment_block_dhcp: "{{ apartment_block }}" ipv6_base_prefix: "2a09:6840" is_aurore_host: "{{ 'aurore_vm' in group_names }}" - -# Borgbackup -borg_keep_daily: 7 -borg_keep_weekly: 4 -borg_keep_monthly: 12 -borg_backup_directories: - - /etc - - /var -borg_backup_exclude: - - /var/log - - /var/lib/docker - - /var/lib/lxcfs -borg_encryption_passphrase: "{{ vault_borg_encryption_passphrase }}" - -borg_server_host: 10.128.0.4 ... diff --git a/host_vars/caradoc.adm.auro.re.yml b/host_vars/caradoc.adm.auro.re.yml deleted file mode 100644 index 2416ab3..0000000 --- a/host_vars/caradoc.adm.auro.re.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -borg_keep_hourly: 6 -borg_keep_daily: 7 -borg_keep_weekly: 4 -borg_keep_monthly: 12 -borg_backup_directories: - - "/etc" - - "/var" - - "/data_nextcloud" - - "/data_gitea" - - "/data_mail" -... diff --git a/host_vars/log.adm.auro.re.yml b/host_vars/log.adm.auro.re.yml deleted file mode 100644 index 675fe4e..0000000 --- a/host_vars/log.adm.auro.re.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -borg_backup_directories: - - "/etc/" - - "/var/" -borg_backup_exclude: [] -... diff --git a/host_vars/perceval.adm.auro.re.yml b/host_vars/perceval.adm.auro.re.yml deleted file mode 100644 index a534d22..0000000 --- a/host_vars/perceval.adm.auro.re.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -borg_server_backups_dir: /borg -... diff --git a/playbooks/borgbackup.yml b/playbooks/borgbackup.yml index 804f2b0..95f5741 100755 --- a/playbooks/borgbackup.yml +++ b/playbooks/borgbackup.yml @@ -2,6 +2,7 @@ --- - hosts: perceval.adm.auro.re vars: + borg_server_backups_dir: /borg update_motd: borgbackup_server: >- Les sauvegardes (borg) sont stockées dans @@ -10,23 +11,82 @@ - borgbackup_server - update_motd -- hosts: all,!unifi,!unifi-*,!bdd +- hosts: all,!unifi,!unifi-*,!bdd,!caradoc.adm.auro.re vars: + borg_server_host: 10.128.0.4 + borg_encryption_passphrase: "{{ vault_borg_encryption_passphrase }}" + borg_backup_directories: + - /etc + - /var + borg_backup_exclude: + - /var/log + - /var/lib/docker + - /var/lib/lxcfs update_motd: borgbackup_client: >- BorgBackup est déployé (/etc/borgmatic/config.yaml) roles: - - borgbackup_client + #- borgbackup_client + - update_motd + +# On NAS, also backup NAS data +- hosts: caradoc.adm.auro.re + vars: + borg_server_host: 10.128.0.4 + borg_encryption_passphrase: "{{ vault_borg_encryption_passphrase }}" + borg_backup_directories: + - /etc + - /var + - /data_nextcloud + - /data_gitea + - /data_mail + borg_backup_exclude: + - /var/log + - /var/lib/docker + - /var/lib/lxcfs + borg_keep_hourly: 6 + update_motd: + borgbackup_client: >- + BorgBackup est déployé (/etc/borgmatic/config.yaml) + roles: + #- borgbackup_client - update_motd # On databases server, also backup databases - hosts: bdd vars: + borg_server_host: 10.128.0.4 + borg_encryption_passphrase: "{{ vault_borg_encryption_passphrase }}" + borg_backup_directories: + - /etc + - /var + borg_backup_exclude: + - /var/log + - /var/lib/docker + - /var/lib/lxcfs borg_postgresql_databases: true update_motd: borgbackup_client: >- BorgBackup est déployé (/etc/borgmatic/config.yaml) roles: - - borgbackup_client + #- borgbackup_client + - update_motd + +# On log server, also backup logs +- hosts: log.adm.auro.re + vars: + borg_server_host: 10.128.0.4 + borg_encryption_passphrase: "{{ vault_borg_encryption_passphrase }}" + borg_backup_directories: + - /etc + - /var + borg_backup_exclude: + - /var/lib/docker + - /var/lib/lxcfs + update_motd: + borgbackup_client: >- + BorgBackup est déployé (/etc/borgmatic/config.yaml) + roles: + #- borgbackup_client - update_motd ... diff --git a/roles/borgbackup_client/defaults/main.yml b/roles/borgbackup_client/defaults/main.yml index 0ffec29..cb927c5 100644 --- a/roles/borgbackup_client/defaults/main.yml +++ b/roles/borgbackup_client/defaults/main.yml @@ -1,8 +1,8 @@ --- borg_keep_hourly: 0 -borg_keep_daily: 0 -borg_keep_weekly: 0 -borg_keep_monthly: 0 +borg_keep_daily: 7 +borg_keep_weekly: 4 +borg_keep_monthly: 12 borg_server_user: borgbackup borg_server_group: borgbackup ... -- 2.45.2 From c43b7d79276ebdd76c4612b1751917c6b229db53 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 15 Dec 2021 16:34:21 +0100 Subject: [PATCH 3/3] borgbackup: fix motd --- playbooks/borgbackup.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/playbooks/borgbackup.yml b/playbooks/borgbackup.yml index 95f5741..ac0ac4b 100755 --- a/playbooks/borgbackup.yml +++ b/playbooks/borgbackup.yml @@ -5,8 +5,7 @@ borg_server_backups_dir: /borg update_motd: borgbackup_server: >- - Les sauvegardes (borg) sont stockées dans - {{ borg_server_backups_dir }}. + Les sauvegardes (borg) sont stockées dans /borg roles: - borgbackup_server - update_motd -- 2.45.2