https://github.com/ricsanfre/public-host-preparation
Public host automation tasks
https://github.com/ricsanfre/public-host-preparation
ansible backup docker docker-compose gdrive internet-facing restic
Last synced: 2 months ago
JSON representation
Public host automation tasks
- Host: GitHub
- URL: https://github.com/ricsanfre/public-host-preparation
- Owner: ricsanfre
- Created: 2022-08-09T15:17:24.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-19T10:00:18.000Z (over 3 years ago)
- Last Synced: 2025-03-21T15:51:31.140Z (over 1 year ago)
- Topics: ansible, backup, docker, docker-compose, gdrive, internet-facing, restic
- Language: Shell
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Internet-facing host setup
This repo contains a set of Ansible playbooks for preparing a host running on Public Cloud
## Configuration
Set inventory file `inventory.yml` containing the hosts to be configured.
Ip addresses and SSH remote users.
### Dependencies installation
Some ansible roles are needed.
```shell
ansible-galaxy install -r requirements.yml
```
## Backup Configuration
Hosts are configured to use Google Drive as backup repository, using [rclone](https://rclone.org/) integration in [restic](https://restic.net/).
Follow procedure indicated in [rclone documentation](https://rclone.org/drive/) to configure a Google's service account and obtain service account credentials file (JSON file). This need to be placed in `files/google_service_account.json`
rclone remote repository is configured as `gdrive`
Backup/restic configuration for each host can be specified in host var files (`host_vars`)
To configure backup on remote host execute the command:
```shell
ansible-playbook configure_backup.yml
```
### Empty Gdrive Trash commands
Deleted files are moved to gdrive trash. Maintenance tasks requires to empty trash periodically.
`rclone cleanup` command will empty gdrive trash
```shell
rclone cleanup gdrive:
```
There is an open issue where emptyin trash is not working properly (https://github.com/rclone/rclone/issues/3964) and a specific command need to be executed instead. See this [rclone forum post](https://forum.rclone.org/t/empty-google-drive-trash/14331) for more details.
```shell
rclone delete gdrive: --drive-trashed-only --drive-use-trash=false --verbose=2 --fast-list
```
## Docker Installation
Docker and docker-compose can be installed for easily selfhosting applications
```shell
ansible-playbook configure_docker.yml
```