Skip to content

Commit b3fe6df

Browse files
authored
Merge pull request #41 from Xilonz/add-post_actions
✨ Add post_actions
2 parents a8fe720 + 67217fd commit b3fe6df

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
> :warning: **This role was moved and renamed!**: Make sure to update your `galaxy.yml` (or `requirements.yml` if you have an older Trellis version).
2-
31
# trellis-backup-role
42

53
This role is made to be used with [Trellis](https://roots.io/trellis/).
@@ -11,7 +9,7 @@ It will :
119
* for each `wordpress_site` configured, it will install two duply profiles
1210
* one for database
1311
* one for uploads
14-
12+
1513
It does not backup website code. If you need to restore, you must first deploy your website on a new server, and then restore your database and uploads.
1614

1715
## Get Started
@@ -21,7 +19,7 @@ Add the role and its dependencies to the `galaxy.yml` file of Trellis :
2119
```yaml
2220
- name: backup
2321
src: xilonz.trellis_backup
24-
version: 2.1.5
22+
version: 2.1.7
2523
```
2624
2725
Run `ansible-galaxy install -r galaxy.yml` to install the new roles.
@@ -66,6 +64,8 @@ wordpress_sites:
6664
+ max_age: 1M # time frame for old backups to keep, Used for the "purge" command.
6765
+ full_max_age: 1M # forces a full backup if last full backup reaches this age.
6866
+ max_full_backups: 1 # number of full backups to keep
67+
+ post_actions: # optional
68+
+ - "curl -L http://your-custom-endpoint" # commands to run after backup is completed
6969
```
7070

7171
You can set `enabled: true` and `auto: false` to install duply profiles

tasks/main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# Define the backup jobs
1111
backup_profiles:
12-
# Backup uploads
12+
# Backup uploads
1313
- name: "{{ item.key }}_uploads"
1414
schedule: "{{ item.value.backup.schedule | default(omit) }}"
1515
source: "{{ www_root }}/{{ item.key }}/shared/uploads"
@@ -21,8 +21,9 @@
2121
max_full_backups: "{{ item.value.backup.max_full_backups | default('1') }}"
2222
params: "{{ item.value.backup.params | default([]) }}"
2323
action: "{{ site_purge_backup | ternary('purge_backup --force', 'backup') }}"
24+
post_actions: "{{ item.value.backup.post_actions | default([]) }}"
2425

25-
# Backup database
26+
# Backup database
2627
- name: "{{ item.key }}_database"
2728
schedule: "{{ item.value.backup.schedule | default(omit) }}"
2829
source: "mysql://{{ site_env.db_name }}"
@@ -34,6 +35,7 @@
3435
max_full_backups: "{{ item.value.backup.max_full_backups | default('1') }}"
3536
params: "{{ item.value.backup.params | default([]) }}"
3637
action: "{{ site_purge_backup | ternary('purge_backup --force', 'backup') }}"
38+
post_actions: "{{ item.value.backup.post_actions | default([]) }}"
3739

3840
when: site_uses_backup
3941
with_dict: "{{ wordpress_sites }}"

0 commit comments

Comments
 (0)