From 19b0702d4c1ed755fd99a4ae52d0164353fc159d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 18 Mar 2021 19:34:34 +0100 Subject: [PATCH] drop creating backups, will be done with Restic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub Sokołowski --- README.md | 26 -------------------------- defaults/main.yml | 7 ------- tasks/backup.yml | 28 ---------------------------- tasks/main.yml | 1 - 4 files changed, 62 deletions(-) delete mode 100644 tasks/backup.yml diff --git a/README.md b/README.md index 37fe104..ab486b4 100644 --- a/README.md +++ b/README.md @@ -44,29 +44,3 @@ Configuration consists of two templates: * `grafana.ini.j2` - Grafana main configuration file. * `prometheus.yml.j2` - Initial configuration of the query backend(s). - -# Backups - -Done by a Sytemd timer daily: -``` - > sudo systemctl list-timers 'grafana-backup' -NEXT LEFT LAST PASSED UNIT ACTIVATES -Wed 2020-12-09 00:00:00 UTC 3h 10min left n/a n/a grafana-backup.timer grafana-backup.service - - > sudo systemctl status grafana-backup -● grafana-backup.service - Grafana batabase backup - Loaded: loaded (/lib/systemd/system/grafana-backup.service; static; vendor preset: enabled) - Active: inactive (dead) since Tue 2020-12-08 20:48:45 UTC; 6s ago -TriggeredBy: ● grafana-backup.timer - Docs: https://github.com/status-im/infra-role-systemd-timer - Process: 1938613 ExecStart=/usr/local/bin/grafana-backup (code=exited, status=0/SUCCESS) - Main PID: 1938613 (code=exited, status=0/SUCCESS) -``` -``` - > ls -lh /var/backups/grafana -total 2.3M --rw-r--r-- 1 root root 563K Dec 5 20:20 grafana-20201205-202043.db.gz --rw-r--r-- 1 root root 563K Dec 6 20:48 grafana-20201206-204838.db.gz --rw-r--r-- 1 root root 563K Dec 7 20:48 grafana-20201207-204840.db.gz --rw-r--r-- 1 root root 563K Dec 8 20:48 grafana-20201208-204845.db.gz -``` diff --git a/defaults/main.yml b/defaults/main.yml index 4667a99..dd84ce0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -39,13 +39,6 @@ grafana_smtp_port: ~ grafana_smtp_user: ~ grafana_smtp_pass: ~ -# Backups -grafana_backup_dir: '/var/backups/{{ grafana_service_name }}' -grafana_backup_user: 'root' -grafana_backup_frequency: 'daily' -grafana_backup_timeout_sec: 30 -grafana_backup_max_kept: 14 - # optional anonymous access grafana_anonymous: false diff --git a/tasks/backup.yml b/tasks/backup.yml deleted file mode 100644 index 7bf802c..0000000 --- a/tasks/backup.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- name: Create backups directory - file: - path: '{{ grafana_backup_dir }}' - owner: '{{ grafana_backup_user }}' - group: 'adm' - state: directory - mode: 0750 - -- name: Create backup timer service - include_role: name=systemd-timer - vars: - systemd_timer_description: 'Grafana batabase backup' - systemd_timer_name: 'backup-{{ grafana_service_name }}' - systemd_timer_user: '{{ grafana_backup_user }}' - systemd_timer_frequency: '{{ grafana_backup_frequency }}' - systemd_timer_timeout_sec: '{{ grafana_backup_timeout_sec }}' - systemd_timer_work_dir: '{{ grafana_backup_dir }}' - systemd_timer_start_on_creation: true - systemd_timer_script_content: | - #!/usr/bin/env bash - MAX_KEPT={{ grafana_backup_max_kept }} - DB_PATH="{{ grafana_cont_vol }}/lib/grafana.db" - TSAMP=$(date -u +%Y%m%d-%H%M%S) - echo "Saving Grafana database..." - gzip -c "${DB_PATH}" > "grafana-${TSAMP}.db.gz" - echo "Cleaning up old archives..." - rm -vf $(ls -Art | head -n -${MAX_KEPT}) diff --git a/tasks/main.yml b/tasks/main.yml index 7c68033..dae944c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,4 +2,3 @@ - import_tasks: config.yml - import_tasks: container.yml - import_tasks: consul.yml -- import_tasks: backup.yml