aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2022-12-13 12:55:05 -0800
committerclarkzjw <[email protected]>2022-12-13 12:55:05 -0800
commit1da9d7731b8cda1f433bb5b33a3922716844b1bb (patch)
treebf07602f9c7e4d1efc231ea52a44c5bbb8d142e6
parent9c1be2b1bfb92af05a1b6e724608a55eec772425 (diff)
downloadjinwei.me-1da9d7731b8cda1f433bb5b33a3922716844b1bb.tar.gz
config: setup cronjob for additional daily wordpress snapshot
-rw-r--r--jinwei.me/config/roles/debian_init/tasks/main.yaml1
-rw-r--r--jinwei.me/config/roles/wordpress/defaults/main.yaml1
-rw-r--r--jinwei.me/config/roles/wordpress/tasks/main.yaml15
3 files changed, 15 insertions, 2 deletions
diff --git a/jinwei.me/config/roles/debian_init/tasks/main.yaml b/jinwei.me/config/roles/debian_init/tasks/main.yaml
index 002da90..750f83c 100644
--- a/jinwei.me/config/roles/debian_init/tasks/main.yaml
+++ b/jinwei.me/config/roles/debian_init/tasks/main.yaml
@@ -13,6 +13,7 @@
13 - mariadb-client 13 - mariadb-client
14 - cifs-utils 14 - cifs-utils
15 - vnstat 15 - vnstat
16 - postfix
16 - lsb-release 17 - lsb-release
17 - python3 18 - python3
18 - python3-dev 19 - python3-dev
diff --git a/jinwei.me/config/roles/wordpress/defaults/main.yaml b/jinwei.me/config/roles/wordpress/defaults/main.yaml
index 250e0a5..7eef363 100644
--- a/jinwei.me/config/roles/wordpress/defaults/main.yaml
+++ b/jinwei.me/config/roles/wordpress/defaults/main.yaml
@@ -2,3 +2,4 @@ wordpress_image: clarkzjw/wordpress
2wordpress_image_tag: 20221211 2wordpress_image_tag: 20221211
3wordpress_port: 30080 3wordpress_port: 30080
4wordpress_home: /opt/wordpress 4wordpress_home: /opt/wordpress
5samba_backup_path: /mnt/samba/VPS/aws-jinwei-me/wordpress/
diff --git a/jinwei.me/config/roles/wordpress/tasks/main.yaml b/jinwei.me/config/roles/wordpress/tasks/main.yaml
index 3835145..128a3e9 100644
--- a/jinwei.me/config/roles/wordpress/tasks/main.yaml
+++ b/jinwei.me/config/roles/wordpress/tasks/main.yaml
@@ -1,4 +1,4 @@
1- name: Pull wordpress Docker image 1- name: pull wordpress Docker image
2 community.docker.docker_image: 2 community.docker.docker_image:
3 name: "{{ wordpress_image }}:{{ wordpress_image_tag }}" 3 name: "{{ wordpress_image }}:{{ wordpress_image_tag }}"
4 source: pull 4 source: pull
@@ -9,8 +9,19 @@
9 dest: "{{ wordpress_home }}/docker-compose.yaml" 9 dest: "{{ wordpress_home }}/docker-compose.yaml"
10 mode: 0644 10 mode: 0644
11 11
12- name: Start wordpress container using docker-compose 12- name: start wordpress container using docker-compose
13 community.docker.docker_compose: 13 community.docker.docker_compose:
14 project_name: wordpress 14 project_name: wordpress
15 project_src: "{{ wordpress_home }}" 15 project_src: "{{ wordpress_home }}"
16 register: output 16 register: output
17
18- name: setup cronjob for additional backup
19 cron:
20 cron_file: wordpress_backup_hetzner
21 user: root
22 state: present
23 name: "wordpress backup"
24 minute: "0"
25 hour: "0"
26 day: "*"
27 job: "tar caf /tmp/wordpress-$(date -u +\\%Y-\\%m-\\%d-\\%H-\\%M-\\%S\\%Z).tar.xz {{ wordpress_home }} && rsync -azvP /tmp/wordpress-*.tar.xz {{ samba_backup_path }}"
Powered by cgit v1.2.3 (git 2.41.0)