diff --git a/group_vars/all.yml b/group_vars/all.yml index 0bf86631..df0443ca 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -29,9 +29,6 @@ krusader_enabled: false # Backup & Restore timemachine_enabled: false -# Software build and CI -gitlab_enabled: false - # IRC thelounge_enabled: false @@ -286,16 +283,6 @@ stat_collection_interval: 15s grafana_influxdb_port: "8086" grafana_port: "3000" - -### -### Gitlab -### -gitlab_available_externally: "false" -gitlab_data_directory: "{{ docker_home }}/gitlab" -gitlab_port_http: "4080" -gitlab_port_https: "4443" -gitlab_port_ssh: "422" - ### ### Guacamole ### diff --git a/nas.yml b/nas.yml index c4427f66..591900a8 100644 --- a/nas.yml +++ b/nas.yml @@ -93,15 +93,20 @@ - firefly when: (firefly_enabled | default(False)) + - role: get_iplayer + tags: + - get_iplayer + when: (get_iplayer_enabled | default(False)) + - role: gitea tags: - gitea when: (gitea_enabled | default(False)) - - role: get_iplayer + - role: gitlab tags: - - get_iplayer - when: (get_iplayer_enabled | default(False)) + - gitlab + when: (gitlab_enabled | default(False)) - role: glances tags: diff --git a/roles/gitlab/defaults/main.yml b/roles/gitlab/defaults/main.yml new file mode 100644 index 00000000..d39ec41a --- /dev/null +++ b/roles/gitlab/defaults/main.yml @@ -0,0 +1,16 @@ +--- +# enable or disable the application +gitlab_enabled: false +gitlab_available_externally: "false" + +# directories +gitlab_data_directory: "{{ docker_home }}/gitlab" + +# network +gitlab_hostname: "gitlab" +gitlab_port_http: "4080" +gitlab_port_https: "4443" +gitlab_port_ssh: "422" + +# specs +gitlab_memory: "4g" diff --git a/tasks/gitlab.yml b/roles/gitlab/tasks/main.yml similarity index 71% rename from tasks/gitlab.yml rename to roles/gitlab/tasks/main.yml index c0cfbc6e..0d3e37b0 100644 --- a/tasks/gitlab.yml +++ b/roles/gitlab/tasks/main.yml @@ -16,6 +16,16 @@ create_home: no group: gitlab +- 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 }}" @@ -27,7 +37,7 @@ - "{{ gitlab_data_directory }}/log" - "{{ gitlab_data_directory }}/data" -- name: Create Gitlab container +- name: Create Gitlab Docker Container docker_container: name: gitlab image: gitlab/gitlab-ce:latest @@ -36,16 +46,21 @@ - "{{ gitlab_data_directory }}/config:/etc/gitlab:rw" - "{{ gitlab_data_directory }}/log:/var/log/gitlab:rw" - "{{ gitlab_data_directory }}/data:/var/opt/gitlab:rw" + network_mode: "bridge" ports: - "{{ gitlab_port_http }}:80" - "{{ gitlab_port_https }}:443" - "{{ gitlab_port_ssh }}:22" - hostname: "gitlab.{{ ansible_nas_domain }}" + env: + TZ: "{{ ansible_nas_timezone }}" + PUID: "{{ gitlab_user_id }}" + PGID: "{{ gitlab_group_id }}" restart_policy: unless-stopped - memory: 4g + hostname: "{{ gitlab_hostname }}.{{ ansible_nas_domain }}" + memory: "{{ gitlab_memory }}" labels: traefik.enable: "{{ gitlab_available_externally }}" - traefik.http.routers.gitlab.rule: "Host(`gitlab.{{ ansible_nas_domain }}`)" + 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 }}"