Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
README.md 9.16 KiB

Ansible Role: YunoHost

:flag_fr: French version

Deploy YunoHost with Ansible!

Requirements

YunoHost needs to be installed on your server.

Role Variables

The default variables are available in default/main.yml however it is possible to override them according to your needs. We have integrated three different backup systems to this YunoHost role:

YunoHost native local backups

YunoHost provides its own native backup system. It is able to back up YunoHost configuration, mails (if YunoHost is used as a mail server) and applications installed on YunoHost. It is possible to create and restore backups from the web administration interface as well as from the command line in SSH (yunohost backup). Backups are available locally, and we have automated the triggering of these backups. More info here.

ynh_backup:
  scheduled:         True
  directory:         "/data/backup"
  scheduled_hour:    "*"
  scheduled_minute:  "*/30"
  scheduled_weekday: "*"
  scheduled_month:   "*"
  system:            True
  apps:              True
  number_days_to_keep: "2"
  • ynh_backup.scheduled: Enable the YunoHost applications backup feature by setting the value to True.
  • ynh_backup.directory: the default backup folder is /home/yunohost.backup/archives. You can choose to save the backups in another folder with this variable. In this case, in order to be able to restore the backups from the web interface, YunoHost automatically creates a symbolic link from the created archive to its default folder.
  • ynh_backup.scheduled_[hour|minute|weekday|month]: modifies the scheduling of the cron task. By default, it will run every day of the year at 3am. For more information about cron time settings, this tool can be useful: https://crontab.guru/.
  • ynh_backup.system: Disable YunoHost system backup by setting the value to False, the default value is True.
  • ynh_backup.apps: Disable backup of YunoHost applications by setting the value to False, the default is True.
  • ynh_backup.number_days_to_keep: Determines the number of days to keep for the purging system, the default is 2.
  • :warning: Beware, once you enable the local backup feature ynh_backup.scheduled, you cannot disable system and application backups. If you set ynh_backup.system and ynh_backup.apps to False, the role will fail.

remote backups with YunoHost BorgBackup

  • Backups with BorgBackup and Borgmatic: Thanks to the Ansible role m3nu.ansible_role_borgbackup we can automate the installation and configuration process of Borg Backup on a YunoHost server. Borg backups are accessible on a local or a remote Borg repository. More info about this role here.
ynh_borg_backup_scheduled: True
borg_source_directories:    "{{ ynh_backup.directory }}"
borg_repository:            "/data/backup/borg_repository"
borg_encryption_passphrase: "PLEASECHANGEME"
borgmatic_config_name:      "borgmatic_ynh_config"
borgmatic_cron_name:        "borgmatic_ynh_cron"
borg_retention_policy:
  keep_daily: "4"
ynh_borg_backup_remote_repo: True
borg_ssh_keys_src:          "files/prd/ssh_keys/ynh_ed25519.vault"
borg_ssh_keys_dest:         "/home/debian/.ssh/ynh_ed25519"
ynh_ssh_borg_command:       "ssh_command: ssh -p 7410 -o StrictHostKeychecking=no -i {{ borg_ssh_keys_dest }}"
  • ynh_borg_backup_scheduled: Enable / disable the backup feature with BorgBackup.
  • ynh_borg_backup_remote_repo: Enable / disable the backup functionality on a BorgBackup remote repository (tasks related to SSH keys setup). If you enable this feature, then you will need to use borg_ssh_keys_src and borg_ssh_keys_dest variables.
  • borg_source_directories: List of source folders to back up. By default, this is the folder in which YunoHost local backups are located.
  • borg_repository: Full path to the Borg repository. Possibility to give a list of repositories to save data in several places.
  • borg_encryption_passphrase : Mandatory, password to use for the Borg repository encryption key.
  • borgmatic_config_name: Optional, name of the Borgmatic configuration file.
  • borgmatic_cron_name: Optional, name of the cron task file.
  • borg_retention_policy.keep_[hourly|daily|weekly|monthly]: Allows you to fine-tune the number of recent archives the repository should keep.
  • borg_ssh_keys_src: Path to the SSH public/private key pair on the Ansible host. Consider using Ansible Vault to protect your SSH keys.
  • borg_ssh_keys_dest: Path where the SSH key pair will be copied to the YunoHost server.
  • ynh_ssh_borg_command: Optional, custom SSH command run when using Borg on a remote repository.

Feel free to look at the variables available in the role.

remote backups with YunoHost Restic

  • Backups with Restic: Thanks to the Ansible role do1jlr.restic we can automate the installation and configuration process of Restic on a YunoHost server. Restic backups can be done on a local or a remote Restic repository and compatible with S3 object storage. More info about this role here.

:warning: Be careful, in order to use the Ansible role do1jlr.restic, you must have the following packages installed on the machine running Ansible: