ansible-role-gitlab/tasks/main.yml

59 lines
1.3 KiB
YAML
Raw Normal View History

2020-04-11 13:16:20 +00:00
---
2023-07-06 15:08:39 +00:00
- name: Install dependencies packages
2021-08-24 07:13:44 +00:00
ansible.builtin.package:
name:
- cron
- gpg
tags: gitlab
2023-07-06 15:08:39 +00:00
- name: Add gpg key
2021-08-24 06:06:07 +00:00
ansible.builtin.apt_key:
2020-04-11 13:16:20 +00:00
url: https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
tags: gitlab
2023-07-06 15:08:39 +00:00
- name: Add repository
2021-08-24 06:06:07 +00:00
ansible.builtin.apt_repository:
2020-04-11 13:16:20 +00:00
repo: '{{ gitlab_repository }}'
tags: gitlab
2023-07-06 15:08:39 +00:00
- name: Install package
2021-08-24 06:06:07 +00:00
ansible.builtin.package:
name:
- gitlab-ce
2020-04-11 13:16:20 +00:00
tags: gitlab
2023-07-06 15:08:39 +00:00
- name: Copy config
2021-08-24 06:06:07 +00:00
ansible.builtin.template:
2020-04-11 13:16:20 +00:00
src: gitlab.rb.j2
dest: /etc/gitlab/gitlab.rb
owner: root
group: root
mode: 0600
2023-07-06 15:08:39 +00:00
notify: Reconfigure gitlab
2020-04-11 13:16:20 +00:00
tags: gitlab
2023-07-06 15:08:39 +00:00
- name: Init gitlab
2021-08-24 06:06:07 +00:00
ansible.builtin.command: gitlab-ctl reconfigure
2020-04-11 13:16:20 +00:00
args:
creates: /usr/lib/systemd/system/gitlab-runsvdir.service
tags: gitlab
2023-07-06 15:08:39 +00:00
- name: Enable and start service
2021-08-24 06:06:07 +00:00
ansible.builtin.service:
2020-04-11 13:16:20 +00:00
name: gitlab-runsvdir
state: started
enabled: true
tags: gitlab
2021-08-24 06:30:10 +00:00
2023-07-06 15:08:39 +00:00
- name: Add backup cron
2021-08-24 06:30:10 +00:00
ansible.builtin.cron:
name: gitlab-backup
user: root
job: gitlab-backup create
2023-07-06 15:08:39 +00:00
month: '{{ gitlab_backup_cron_month | string }}'
weekday: '{{ gitlab_backup_cron_weekday | string }}'
day: '{{ gitlab_backup_cron_day | string }}'
hour: '{{ gitlab_backup_cron_hour | string }}'
minute: '{{ gitlab_backup_cron_minute | string }}'
2021-08-24 06:30:10 +00:00
tags: gitlab