30 lines
810 B
YAML
30 lines
810 B
YAML
---
|
|
# tasks file for gitlab
|
|
- name: Ensure a gitlab container is running.
|
|
docker_container:
|
|
name: "{{ gitlab_container_name }}"
|
|
state: present
|
|
image: gitlab/gitlab-ce
|
|
comparisons:
|
|
'*': ignore
|
|
|
|
- name: Start gitlab backup
|
|
community.docker.docker_container_exec:
|
|
container: "{{ gitlab_container_name }}"
|
|
command: gitlab-backup create GZIP_RSYNCABLE=yes SKIP=registry
|
|
|
|
- name: Get list of backups
|
|
find:
|
|
paths: "{{ gitlab_backup_directory }}"
|
|
register: found_files
|
|
|
|
- name: Get latest backup
|
|
set_fact:
|
|
latest_file: "{{ found_files.files | sort(attribute='mtime',reverse=true) | first }}"
|
|
|
|
- name: Download latest backup from remote
|
|
ansible.posix.synchronize:
|
|
src: "{{ latest_file.path }}"
|
|
dest: "{{ gitlab_local_backup_directory }}"/backups
|
|
mode: pull
|