Newer
Older
update_cache: yes
state: present
pkg:
- curl
- openssh-server
- ca-certificates
- tzdata
- perl
- gnupg
- apt-transport-https
update_cache: yes
state: present
pkg:
- debian-archive-keyring
when: ansible_distribution == 'Debian'
- name: Add an Apt signing key, uses whichever key is at the URL
ansible.builtin.apt_key:
url: https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
state: present
- name: Add specified repository into sources list
ansible.builtin.apt_repository:
repo: deb https://packages.gitlab.com/gitlab/gitlab-ce/{{ ansible_distribution | lower }}/ {{ ansible_distribution_release | lower }} main
- name: Install gitlab-ce
ansible.builtin.apt:
update_cache: yes
state: present
pkg:
- gitlab-ce
backup: yes
register: gitlab_config
notify: Reconfigure gitlab
- name: Backup previous gitlab config
ansible.builtin.copy:
dest: "/opt/gitlab.rb"
src: "{{ gitlab_config.backup_file }}"
remote_src: true
when: gitlab_config.changed
path: "{{ gitlab_config.backup_file }}"
state: absent
when: gitlab_config.changed
- name: Gitlab backup setup
ansible.builtin.copy:
content: |
{{ gitlab_backup_cron }} root backup-gitlab create CRON=1 {{ gitlab_backup_options | default(omit) }}
dest: "/etc/cron.d/gitlab-backup"
owner: root
group: root
mode: '0644'
when: gitlab_backup_cron is defined