Giter Site home page Giter Site logo

ansible-playbook-qb.backup's Introduction

qb.backup - Example playbook

This repository contains an example playbook that configures three hosts:

  • One FreeBSD 11.3 jail running on a FreeNAS 11.2-U7 host and serving as the backup server,
  • Two Debian (>= 8) servers that need to be backuped.

It serves as an example of how to use Ansible roles qb.backup and qb.backup_server.

You can find here a video of our talk at FOSDEM'20 presenting how qb.backup works.

Requirements

For the Ansible controller

This repository contains submodules, please ensure that they are initialized:

$ git submodule init
$ git submodule update

The inventory.yml file must be modified with the correct values for your setup, as well as all the various files in the group_vars folder.

This playbook has been tested with ansible>=2.8.0.

For the FreeNAS server

Note: If you do not have a FreeNAS server, you can still setup the server-side script of qb.backup on any other host. You will have to manually do the installation yourself. You can adapt the role qb.backup_server for your needs.

The configuration of the FreeNAS server is not in the scope of this example. The pre-requisites on the FreeNAS server are simple:

  • The person running this Ansible playbook must be able to connect using a SSH key to the root user of the FreeNAS server,
  • The FreeBSD jail must be created and running.
  • The dataset used to store backups must be mounted in the jail in /mnt/backup using FreeNAS's "Mount points" jail option.

For the FreeBSD Jail

Python 3.7 must be manually installed in the jail:

# pkg bootstrap
# pkg update -f
# pkg install python37

For the backuped hosts

Note: The role configuring backuped hosts targets Debian >= 8 servers. Any other OS that can run SSH, borg and borgmatic can be used in this backup solution by manually configuring those hosts.

You can manually setup hosts that need to be backuped by following the instructions of the README.md file in the role qb.backup.

The following SSH server options must be enabled on the servers that need to be backuped:

# File: /etc/ssh/sshd_config
PermitRootLogin forced-commands-only # Or greater level of access
PermitUserEnvironment yes

Note: since qb.backup aims to take whole server backups, we connect using the user root directly to avoid permission issues, so sshd must not deny SSH connections to root.

The minimum level of authentication we support for PermitRootLogin is forced-commands-only, but any level above would work (prohibit-password or yes).

Instructions

Once all the requirements are met, you can execute the playbook:

$ ansible-playbook -i inventory.yml backup-playbook.yml

The playbook will fail the first time, just follow the instructions in the error message to edit the variable backup_clt__srv_ssh_pubkey.

Important note: The backup client setup role saves on the Ansible controller running the playbook one borg repository encryption key passphrase per backuped host. By default, those passphrases are saved in /tmp/backup-passphrases/ which is a temporary folder erased at reboot, so make sure to move those passphrases to a secure place as they will be needed to recover backups in case of a loss of data!

ansible-playbook-qb.backup's People

Contributors

atripier avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

markhorsfield

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.