Ansible/gitlab/tasks/main.yml

29 lines
811 B
YAML
Raw Normal View History

2022-02-08 23:04:05 +00:00
---
# tasks file for gitlab
- name: Ensure a gitlab container is running.
docker_container:
name: "{{ gitlab_container_name }}"
state: present
image: gitlab/gitlab-ce
container_default_behavior: no_defaults
- name: Start gitlab backup
community.docker.docker_container_exec:
container: "{{ gitlab_container_name }}"
command: gitlab-backup create GZIP_RSYNCABLE=yes
- 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 }}"
delegate_to: delegate.host