Improve backup service
This commit is contained in:
		
							parent
							
								
									9b7b5d3642
								
							
						
					
					
						commit
						33d5e30ba6
					
				
					 5 changed files with 26 additions and 18 deletions
				
			
		|  | @ -32,3 +32,7 @@ | |||
|         chdir: "{{ service_path }}" | ||||
|       changed_when: false | ||||
|       become: true | ||||
|       register: cmd_result_verify | ||||
|       until: "cmd_result_verify is not failed" | ||||
|       retries: 10 | ||||
|       delay: 10 | ||||
|  |  | |||
|  | @ -5,8 +5,8 @@ | |||
| if autorestic backup -av --ci | ||||
| then | ||||
|     {{ backup_hc_command_success }} | ||||
|     {{ backup_uk_command_success }} | ||||
|     {{ backup_gatus_command_success }} | ||||
| else | ||||
|     {{ backup_hc_command_fail }} | ||||
|     {{ backup_uk_command_fail }} | ||||
|     {{ backup_gatus_command_fail }} | ||||
| fi | ||||
|  |  | |||
|  | @ -12,29 +12,33 @@ backup_msg_success: "Backup successful" | |||
| 
 | ||||
| backup_curl_base: 'curl -L -m 10 --retry 5' | ||||
| backup_hc_curl_base: '{{ backup_curl_base }} -X POST -H "Content-Type: text/plain"' | ||||
| backup_uk_curl_base: '{{ backup_curl_base }}' | ||||
| backup_gatus_curl_base: '{{ backup_curl_base }} -X POST -H "Authorization: Bearer {{ host_backup.gatus_token }}"' | ||||
| backup_hc_url: '{{ host_backup.hc_url }}' | ||||
| backup_uk_url: 'https://status.serguzim.me/api/push/{{ host_backup.uptime_kuma_token }}' | ||||
| backup_gatus_url: 'https://status.serguzim.me/api/v1/endpoints/8-backups_backup@{{ ansible_facts.hostname }}/external' | ||||
| 
 | ||||
| backup_hc_command_start: '{{ backup_hc_curl_base }} --data "{{ backup_msg_start }}" {{ backup_hc_url }}/start' | ||||
| backup_hc_command_success: '{{ backup_hc_curl_base }} --data "{{ backup_msg_success }}" {{ backup_hc_url }}' | ||||
| backup_uk_command_success: '{{ backup_uk_curl_base }} "{{ backup_uk_url }}?status=up&msg={{ backup_msg_success | urlencode }}&ping="' | ||||
| backup_hc_command_fail: '{{ backup_hc_curl_base }} --data "{{ backup_msg_fail }}" {{ backup_hc_url }}/fail' | ||||
| backup_uk_command_fail: '{{ backup_uk_curl_base }} "{{ backup_uk_url }}?status=down&msg={{ backup_msg_fail | urlencode }}&ping="' | ||||
| 
 | ||||
| backup_gatus_command_success: '{{ backup_gatus_curl_base }} "{{ backup_gatus_url }}?success=true"' | ||||
| backup_gatus_command_fail: '{{ backup_gatus_curl_base }} "{{ backup_gatus_url }}?success=false&error={{ backup_msg_fail | urlencode }}"' | ||||
| 
 | ||||
| backup_default_hooks: | ||||
|   failure: | ||||
|     - '{{ backup_hc_curl_base }} --data "{{ backup_msg_fail_location }}${AUTORESTIC_LOCATION}" {{ backup_hc_url }}/fail' | ||||
|     - '{{ backup_uk_curl_base }} "{{ backup_uk_url }}?status=down&msg={{ backup_msg_fail_location | urlencode }}${AUTORESTIC_LOCATION}&ping="' | ||||
|     - '{{ backup_gatus_curl_base }} "{{ backup_gatus_url }}?success=false&error={{ backup_msg_fail_location | urlencode }}${AUTORESTIC_LOCATION}' | ||||
| 
 | ||||
| backup_yml: | ||||
|   version: 2 | ||||
| 
 | ||||
|   backends: "{{ vault_backup.locations }}" | ||||
|   backends: "{{ vault_backup.backends }}" | ||||
| 
 | ||||
|   locations: "{{ backup_list | map_backup_locations(vault_backup.locations, backup_default_hooks ) }}" | ||||
|   locations: "{{ backup_list | map_backup_locations(vault_backup.backends, backup_default_hooks ) }}" | ||||
| 
 | ||||
|   global: | ||||
|     all: | ||||
|       cache-dir: "{{ (service_path, 'cache') | path_join }}" | ||||
|       retry-lock: 5m | ||||
|     forget: | ||||
|       keep-last: 7 | ||||
|       keep-daily: 14 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue