Verschiebe Backup Tasks
This commit is contained in:
		
							
								
								
									
										21
									
								
								handlers/backup.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								handlers/backup.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
- name: Stop Gitea for Backup
 | 
			
		||||
  community.docker.docker_compose:
 | 
			
		||||
    project_src: /opt/gitea
 | 
			
		||||
    state: present
 | 
			
		||||
    stopped: true
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
  listen:
 | 
			
		||||
    - Backup Gitea
 | 
			
		||||
  notify:
 | 
			
		||||
    - Ensure Gitea is running
 | 
			
		||||
 | 
			
		||||
- name: Backup Gitea Directory
 | 
			
		||||
  ansible.builtin.copy:
 | 
			
		||||
    src: /opt/gitea/
 | 
			
		||||
    dest: "/opt/gitea.backup@{{ lookup('pipe', 'date --utc --iso-8601=seconds') }}"
 | 
			
		||||
    mode: preserve
 | 
			
		||||
    remote_src: true
 | 
			
		||||
    directory_mode: true
 | 
			
		||||
  listen:
 | 
			
		||||
    - Backup Gitea
 | 
			
		||||
  register: backup
 | 
			
		||||
@@ -1,24 +1,6 @@
 | 
			
		||||
- name: Stop Gitea for Backup
 | 
			
		||||
  community.docker.docker_compose:
 | 
			
		||||
    project_src: /opt/gitea
 | 
			
		||||
    state: present
 | 
			
		||||
    stopped: true
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
  listen:
 | 
			
		||||
    - Backup Gitea
 | 
			
		||||
  notify:
 | 
			
		||||
    - Ensure Gitea is running
 | 
			
		||||
 | 
			
		||||
- name: Backup Gitea Directory
 | 
			
		||||
  ansible.builtin.copy:
 | 
			
		||||
    src: /opt/gitea/
 | 
			
		||||
    dest: "/opt/gitea.backup@{{ lookup('pipe', 'date --utc --iso-8601=seconds') }}"
 | 
			
		||||
    mode: preserve
 | 
			
		||||
    remote_src: true
 | 
			
		||||
    directory_mode: true
 | 
			
		||||
  listen:
 | 
			
		||||
    - Backup Gitea
 | 
			
		||||
  register: backup
 | 
			
		||||
- name: Import Backup Handler
 | 
			
		||||
  ansible.builtin.import_tasks:
 | 
			
		||||
    file: backup.yaml
 | 
			
		||||
 | 
			
		||||
- name: Ensure Gitea is restarted
 | 
			
		||||
  community.docker.docker_compose:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user