infrastructure/ansible/roles/s3_sync/tasks/main.yml

47 lines
983 B
YAML
Raw Normal View History

- name: Include vault
include_vars: vault.yml
- name: Install rclone
package:
name: rclone
- name: Install runitor
kewlfft.aur.aur:
name: runitor-bin
- name: Make user
user:
name: rclone
shell: /bin/nologin
system: false
register: rclone_user
- name: Create config directory
file:
path: "{{ rclone_user.home }}/.config/rclone"
state: directory
owner: rclone
mode: "0700"
- name: Install rclone config
template:
src: files/rclone.conf
dest: "{{ rclone_user.home }}/.config/rclone/rclone.conf"
owner: rclone
mode: "0600"
- name: Create config directory
file:
path: "{{ rclone_user.home }}/sync"
state: directory
owner: rclone
mode: "0700"
- name: Schedule sync
cron:
name: Sync terraform state
hour: 23
minute: 0
job: CHECK_UUID={{ vault_healthchecks_id }} /usr/bin/runitor -- /usr/bin/rclone sync s3:0rng-terraform {{ rclone_user.home }}/sync/0rng-terraform
user: rclone