ansible-nas/roles/gitlab/tasks/main.yml

68 lines
1.9 KiB
YAML
Raw Normal View History

---
# The gitlab uid/gid matches 'git:git' in the Gitlab Docker image.
- name: Create Gitlab group account
group:
name: gitlab
gid: 998
state: present
- name: Create Gitlab user account
user:
name: gitlab
uid: 998
state: present
system: yes
update_password: on_create
create_home: no
group: gitlab
2021-02-07 05:15:52 +00:00
- name: Create Gitlab user account
user:
name: gitlab
uid: 998
state: present
system: yes
update_password: on_create
create_home: no
group: gitlab
- name: Create Gitlab Directories
file:
path: "{{ item }}"
state: directory
owner: gitlab
group: gitlab
with_items:
- "{{ gitlab_data_directory }}/config"
- "{{ gitlab_data_directory }}/log"
- "{{ gitlab_data_directory }}/data"
2021-02-07 05:15:52 +00:00
- name: Create Gitlab Docker Container
docker_container:
name: gitlab
image: gitlab/gitlab-ce:latest
pull: true
volumes:
- "{{ gitlab_data_directory }}/config:/etc/gitlab:rw"
- "{{ gitlab_data_directory }}/log:/var/log/gitlab:rw"
- "{{ gitlab_data_directory }}/data:/var/opt/gitlab:rw"
2021-02-07 05:15:52 +00:00
network_mode: "bridge"
ports:
- "{{ gitlab_port_http }}:80"
- "{{ gitlab_port_https }}:443"
- "{{ gitlab_port_ssh }}:22"
2021-02-07 05:15:52 +00:00
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ gitlab_user_id }}"
PGID: "{{ gitlab_group_id }}"
2020-02-07 22:41:21 +00:00
restart_policy: unless-stopped
2021-02-07 05:15:52 +00:00
hostname: "{{ gitlab_hostname }}.{{ ansible_nas_domain }}"
memory: "{{ gitlab_memory }}"
labels:
traefik.enable: "{{ gitlab_available_externally }}"
2021-02-07 05:15:52 +00:00
traefik.http.routers.gitlab.rule: "Host(`{{ gitlab_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.gitlab.tls.certresolver: "letsencrypt"
traefik.http.routers.gitlab.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.gitlab.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.gitlab.loadbalancer.server.port: "80"