Giter VIP home page Giter VIP logo

backups_role's People

Contributors

danypr92 avatar enricostano avatar jordiisidro avatar konykon avatar oyale avatar raneq avatar sauloperez avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

raneq

backups_role's Issues

Unify rendered backup scripts by including sub-templates

Instead of having 3 templates rendering into 3 bash scripts that call each other,
use 3 templates that render into only 1 bash script. cron-main.sh.j2 should look like this:

# common code
set -e
function title {
  ...
}

# prepare tmp dir
...

# compile files to backup
{% include "backups_prepare.sh.j2" %}

# upload backups using restic
{% include "backups_upload.sh.j2" %}

# clean tmp dir
...

Then leave only one template task in tasks/main.yml.
Also remove task Ensure directory for backups temporary data exists , as it's redundant to cron_main.sh.j2

Ansible Galaxy complaints for v1.2.0

Complains:

  • E301: Commands should not change things if nothing needs doing
  • E502: All tasks should be named
  • IMPORTER101: Invalid platform: "Ubuntu-18.04", skipping. ← reopens #13

imatge

Cron patterns to do backups and remove them

Description

Task to clean old backups with restic has a weird schedule. It says “At 11:05 on every 5th day-of-month.” according to "crontab guru" and manpages.

If this is meant to run every 5 minutes, it should read */5 * * * *

Relevant code
https://github.com/coopdevs/backups-role/blob/bfdab61a8b88c7cee9ee608cdbebe94e02765a0d/tasks/main.yml#L32-L34

Discussion

We should discuss how often we call it. The removal itself restic says it's costly. Despite the date check may not be slow, I wouldn't risk.

And the time to do a new backup and remove oldest one should not be daylight (like 11:05), in my opinion.

Create a task to restore a backup

Create a task to restore a backup or at least, to download backed up packs to the same server, like config tar.gz and the database dump.

The restic role we are using lacks this feature, but we can use restic with:

export RESTIC_REPOSITORY={{backups_role_bucket_url  }}
export RESTIC_PASSWORD={{backups_role_restic_password  }}
restic restore latest --target /tmp/restore

Sources:


However, we can do it easier. The restic role adds a helper for every restic repo with the credentials loaded in the environment, so that we could just do:

- name: Restore latest backup
  command: {{ restic_install_path }}/restic-{{ backups_role_restic_repo_name }} restore latest --target {{ backups_role_restore_path }}

yamllint: too many blank lines

===== LINTING ROLE =====
yamllint Warnings:
./defaults/main.yml:38:1: [error] too many blank lines (1 > 0) (empty-lines)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.