Giter Club home page Giter Club logo

ansible-role-backup's Introduction

License: GPL v3

ansible-role-backup

configure hosts as backup client / server and run a scheduled backup from the server using rsync+ssh

optional: handle lxc container on proxmox for backup and use lvm snapshots

Steps:

hosts file

add the groups backup_client and backup_server to the hosts file.

[backup_client]
host1
host2

[backup_server]
bsrv

site.yml

add the backup role to the server and the clients

- hosts: backup_server
  roles:
    - { role: backup, tags: backup }
- hosts: backup_client
  roles:
    - { role: backup, tags: backup }

host vars

backup_server

backup_server: yes
# optional you can adjust some paths
backup_server_path_local: /srv/backup
backup_server_path_sshkey: /root/.ssh/id_rsa
backup_server_path_logdir: /var/log/backup
backup_server_path_status: /var/tmp/backup.status

backup_client

# list of directories to backup
backup_client_dirs:
  - /etc/
  - /srv/

# list of pattern to use as --include= arg
backup_client_include: []

# list of pattern to use as --exclude= arg
backup_client_exclude: []

# list of services to stop befor and start after the backup
backup_client_services: []

# list of databases to dump before the backup
backup_client_databases: []

# optional: list of commands to run before backup
# backup_client_exec_pre:

# optional: list of commands to run after backup
# backup_client_exec_post

# rotate backups
backup_client_rotatecount_daily: 0
backup_client_rotatecount_weekly: 0
backup_client_rotatecount_monthly: 0
backup_client_rotate_weekly_day: 0 # 0=sunday
backup_client_rotate_monthly_day: 1 # -1=last day of month

optional: configure client to backup multiple lxc containers

backup_client_pve: {...}
# if configured, the backup client can be a backup proxy for proxmox lcx containers running on it
# q: why use this method instead of running the client script on the container itself?
# a: we can use lvm snapshots so the downtime of the services on the container can be minimized
# if you like to make use of this, ensure the backup_client_user has the right to perform the required tasks
# or use ackup_client_user: root + backup_client_user_sshdir: /root/.ssh

TODOs / FIXMEs

  • mysql dump: make user / pw configurable
  • check mk local check
  • test exclude / include args (esp. regarding the "Sending command"
  • rsync -R and --delete ...

ansible-role-backup's People

Contributors

zerwes avatar

Watchers

 avatar

ansible-role-backup's Issues

backup client pve: implement a cleanup fct

if the backup script dies (for what ever reason ever...) the snap volumes are still active and mounted
this will cause a failure on the next backup run
so, please leave the toilet clean ...

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.