Add backup of files

This commit is contained in:
Antonio J. Delgado 2023-07-07 09:27:16 +03:00
parent 8054421d2a
commit b4c4ea1cfd

View file

@ -8,6 +8,7 @@
copy:
dest: /etc/docker/daemon.json
content: "{{ docker_daemon_settings|to_json(indent=4, sort_keys=True) }}"
backup: true
- name: Configure docker service and reload it
systemd:
@ -67,6 +68,7 @@
copy:
src: files/Dockerfile
dest: "{{ mastodon_composer_folder }}/Dockerfile"
backup: true
- name: Ensure mastodon folder exists
file:
@ -77,12 +79,14 @@
template:
src: templates/docker-compose.yml.j2
dest: "{{ mastodon_composer_folder }}/docker-compose.yml"
backup: true
- name: Ensure mastodon environment configuration is present
template:
src: templates/env.j2
dest: "{{ mastodon_composer_folder }}/env.production"
mode: 0600
backup: true
- name: Generate secret key
shell: docker-compose run --rm web bundle exec rake secret
@ -101,7 +105,7 @@
path: "{{ mastodon_composer_folder }}/env.production"
line: "SECRET_KEY_BASE={{ mastodon_secret_key_base }}"
regexp: "^SECRET_KEY_BASE="
backup: yes
backup: true
mode: 0600
- name: Generate OTP secret key
@ -121,7 +125,7 @@
path: "{{ mastodon_composer_folder }}/env.production"
line: "OTP_SECRET={{ mastodon_otp_secret }}"
regexp: "^OTP_SECRET="
backup: yes
backup: true
mode: 0600
- name: Generate Paperclip secret key
@ -141,7 +145,7 @@
path: "{{ mastodon_composer_folder }}/env.production"
line: "PAPERCLIP_SECRET={{ mastodon_paperclip_secret }}"
regexp: "^PAPERCLIP_SECRET="
backup: yes
backup: true
mode: 0600
- name: Generate VAPID keypair
@ -167,7 +171,7 @@
line: "{{ vapid_private_key }}"
regexp: "^VAPID_PRIVATE_KEY="
mode: 0600
backup: yes
backup: true
- name: Add Paperclip public key to Mastodon config
lineinfile:
@ -175,7 +179,7 @@
line: "{{ vapid_public_key }}"
regexp: "^VAPID_PUBLIC_KEY="
mode: 0600
backup: yes
backup: true
- name: Build Mastodon container to include secrets
community.docker.docker_compose:
@ -240,36 +244,43 @@
template:
src: templates/mastodon.service.j2
dest: /etc/systemd/system/mastodon.service
backup: true
- name: Deploy Mastodon Media Remove systemd service unit
template:
src: templates/mastodon-media-remove.service.j2
dest: /etc/systemd/system/mastodon-media-remove.service
backup: true
- name: Deploy Mastodon Media Remove systemd timer unit
template:
src: templates/mastodon-media-remove.timer.j2
dest: /etc/systemd/system/mastodon-media-remove.timer
backup: true
- name: Deploy Mastodon Preview Cards Remove systemd service unit
template:
src: templates/mastodon-preview_cards-remove.service.j2
dest: /etc/systemd/system/mastodon-preview_cards-remove.service
backup: true
- name: Deploy Mastodon Preview Cards Remove systemd timer unit
template:
src: templates/mastodon-preview_cards-remove.timer.j2
dest: /etc/systemd/system/mastodon-preview_cards-remove.timer
backup: true
- name: Deploy Mastodon Search Deploy systemd service unit
template:
src: templates/mastodon-search-deploy.service.j2
dest: /etc/systemd/system/mastodon-search-deploy.service
backup: true
- name: Deploy Mastodon Search Deploy systemd timer unit
template:
src: templates/mastodon-search-deploy.timer.j2
dest: /etc/systemd/system/mastodon-search-deploy.timer
backup: true
- name: Enable Mastodon Media Remove systemd timer unit
systemd: