2023-07-17 17:19:04 +02:00
|
|
|
<!--
|
|
|
|
|
SPDX-FileCopyrightText: 2023 Max Mehl <https://mehl.mx>
|
|
|
|
|
|
|
|
|
|
SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|
# Ansible role for deploying seafile-mirror
|
|
|
|
|
|
|
|
|
|
[](https://api.reuse.software/info/src.mehl.mx/mxmehl/seafile-mirror-ansible)
|
|
|
|
|
|
|
|
|
|
This role deploys [Seafile Mirror](https://src.mehl.mx/mxmehl/seafile-mirror)
|
|
|
|
|
and makes sure all requirements and systemd jobs are set up properly.
|
|
|
|
|
|
|
|
|
|
## Requirements
|
|
|
|
|
|
|
|
|
|
* [ansible-role-users](https://src.mehl.mx/mxmehl/ansible-role-users)
|
|
|
|
|
|
|
|
|
|
## Configure
|
|
|
|
|
|
|
|
|
|
Configuration is easiest by setting host/group variables. This is an example
|
|
|
|
|
derived from the [examplary configuration for seafile
|
|
|
|
|
mirror](https://src.mehl.mx/mxmehl/seafile-mirror/src/branch/main/examples/seafile_mirror.conf.yaml):
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
seafile_local_user:
|
|
|
|
|
user: seafile
|
|
|
|
|
seafile_syncs:
|
|
|
|
|
- server: https://my-seafile-server.tld
|
|
|
|
|
user: user@example.com
|
|
|
|
|
password: mysecretpassword
|
|
|
|
|
# The default resync interval
|
|
|
|
|
resync_interval_days: 7
|
|
|
|
|
# Define the libraries which shall be synced
|
|
|
|
|
libs:
|
|
|
|
|
- name: Documents
|
|
|
|
|
# ID of the Seafile library (can be seen in the web UI)
|
|
|
|
|
id: 53976f13-9d24-4d4a-967b-efb598d542ea
|
|
|
|
|
# local directory where the mirror shall be created
|
|
|
|
|
dir: /backup/Documents
|
|
|
|
|
- name: Pictures
|
|
|
|
|
id: 12346f13-9d24-4d4a-1234-efb598d555fa
|
|
|
|
|
dir: /backup/Pictures
|
|
|
|
|
# A library-specific resync interval
|
|
|
|
|
resync_interval_days: 31
|
2024-11-18 10:45:10 +01:00
|
|
|
seafile_cron:
|
|
|
|
|
minute: "20"
|
|
|
|
|
hour: "23"
|
|
|
|
|
day: "*"
|
|
|
|
|
month: "*"
|
|
|
|
|
weekday: "*"
|
2023-07-17 17:19:04 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Run in playbook
|
|
|
|
|
|
|
|
|
|
Here is an example for a playbook:
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
- name: Set up machines
|
|
|
|
|
remote_user: root
|
|
|
|
|
tasks:
|
|
|
|
|
- name: Setup Seafile
|
|
|
|
|
include_role:
|
|
|
|
|
name: seafile
|
|
|
|
|
apply:
|
|
|
|
|
# Execute tasks as user by default
|
|
|
|
|
become: true
|
|
|
|
|
become_user: "{{ seafile_local_user.user }}"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
|
|
Apache-2.0, Copyright Max Mehl
|