Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit c1e6c14

Browse files
committed
Merged in upstream
2 parents 9152925 + ea6b94b commit c1e6c14

File tree

6 files changed

+94
-17
lines changed

6 files changed

+94
-17
lines changed

README.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ None.
1717

1818
Available variables are listed below, along with default values (see `defaults/main.yml`):
1919

20-
gitlab_external_url: "https://gitlab/"
20+
gitlab_domain: gitlab
21+
gitlab_external_url: "https://{{ gitlab_domain }}/"
2122

22-
The URL at which the GitLab instance will be accessible. This is set as the `external_url` configuration setting in `gitlab.rb`, and if you want to run GitLab on a different port (besides 80/443), you can specify the port here (e.g. `https://gitlab:8443/` for port 8443).
23+
The domain and URL at which the GitLab instance will be accessible. This is set as the `external_url` configuration setting in `gitlab.rb`, and if you want to run GitLab on a different port (besides 80/443), you can specify the port here (e.g. `https://gitlab:8443/` for port 8443).
2324

2425
gitlab_git_data_dir: "/var/opt/gitlab/git-data"
2526

@@ -48,14 +49,14 @@ The `gitlab.rb.j2` template packaged with this role is meant to be very generic
4849
### SSL Configuration.
4950

5051
gitlab_redirect_http_to_https: "true"
51-
gitlab_ssl_certificate: "/etc/gitlab/ssl/gitlab.crt"
52-
gitlab_ssl_certificate_key: "/etc/gitlab/ssl/gitlab.key"
52+
gitlab_ssl_certificate: "/etc/gitlab/ssl/{{ gitlab_domain }}.crt"
53+
gitlab_ssl_certificate_key: "/etc/gitlab/ssl/{{ gitlab_domain }}.key"
5354

5455
GitLab SSL configuration; tells GitLab to redirect normal http requests to https, and the path to the certificate and key (the default values will work for automatic self-signed certificate creation, if set to `true` in the variable below).
5556

5657
# SSL Self-signed Certificate Configuration.
5758
gitlab_create_self_signed_cert: "true"
58-
gitlab_self_signed_cert_subj: "/C=US/ST=Missouri/L=Saint Louis/O=IT/CN=gitlab"
59+
gitlab_self_signed_cert_subj: "/C=US/ST=Missouri/L=Saint Louis/O=IT/CN={{ gitlab_domain }}"
5960

6061
Whether to create a self-signed certificate for serving GitLab over a secure connection. Set `gitlab_self_signed_cert_subj` according to your locality and organization.
6162

@@ -71,6 +72,15 @@ Whether to create a self-signed certificate for serving GitLab over a secure con
7172

7273
GitLab LDAP configuration; if `gitlab_ldap_enabled` is `true`, the rest of the configuration will tell GitLab how to connect to an LDAP server for centralized authentication.
7374

75+
gitlab_dependencies:
76+
- openssh-server
77+
- postfix
78+
- curl
79+
- openssl
80+
- tzdata
81+
82+
Dependencies required by GitLab for certain functionality, like timezone support or email. You may change this list in your own playbook if, for example, you would like to install `exim` instead of `postfix`.
83+
7484
gitlab_time_zone: "UTC"
7585

7686
Gitlab timezone.
@@ -124,6 +134,26 @@ If you want to enable [2-way SSL Client Authentication](https://docs.gitlab.com/
124134

125135
GitLab includes a number of themes, and you can set the default for all users with this variable. See [the included GitLab themes to choose a default](https://github.com/gitlabhq/gitlabhq/blob/master/config/gitlab.yml.example#L79-L85).
126136

137+
gitlab_extra_settings:
138+
- gitlab_rails:
139+
- key: "trusted_proxies"
140+
value: "['foo', 'bar']"
141+
- key: "env"
142+
type: "plain"
143+
value: |
144+
{
145+
"http_proxy" => "https://my_http_proxy.company.com:3128",
146+
"https_proxy" => "https://my_http_proxy.company.com:3128",
147+
"no_proxy" => "localhost, 127.0.0.1, company.com"
148+
}
149+
- unicorn:
150+
- key: "worker_processes"
151+
value: 5
152+
- key: "pidfile"
153+
value: "/opt/gitlab/var/unicorn/unicorn.pid"
154+
155+
Gitlab have many other settings ([see official documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template)), and you can add them with this special variable `gitlab_extra_settings` with the concerned setting and the `key` and `value` keywords.
156+
127157
## Dependencies
128158

129159
None.

defaults/main.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
# General config.
3-
gitlab_external_url: "https://gitlab/"
3+
gitlab_domain: gitlab
4+
gitlab_external_url: "https://{{ gitlab_domain }}/"
45
gitlab_git_data_dir: "/var/opt/gitlab/git-data"
56
gitlab_edition: "gitlab-ce"
67
gitlab_version: ''
@@ -9,12 +10,12 @@ gitlab_config_template: "gitlab.rb.j2"
910

1011
# SSL Configuration.
1112
gitlab_redirect_http_to_https: "true"
12-
gitlab_ssl_certificate: "/etc/gitlab/ssl/gitlab.crt"
13-
gitlab_ssl_certificate_key: "/etc/gitlab/ssl/gitlab.key"
13+
gitlab_ssl_certificate: "/etc/gitlab/ssl/{{ gitlab_domain }}.crt"
14+
gitlab_ssl_certificate_key: "/etc/gitlab/ssl/{{ gitlab_domain }}.key"
1415

1516
# SSL Self-signed Certificate Configuration.
1617
gitlab_create_self_signed_cert: "true"
17-
gitlab_self_signed_cert_subj: "/C=US/ST=Missouri/L=Saint Louis/O=IT/CN=gitlab"
18+
gitlab_self_signed_cert_subj: "/C=US/ST=Missouri/L=Saint Louis/O=IT/CN={{ gitlab_domain }}"
1819

1920
# LDAP Configuration.
2021
gitlab_ldap_enabled: "false"
@@ -47,6 +48,14 @@ gitlab_nginx_ssl_client_certificate: ""
4748
# Probably best to leave this as the default, unless doing testing.
4849
gitlab_restart_handler_failed_when: 'gitlab_restart.rc != 0'
4950

51+
# Dependencies.
52+
gitlab_dependencies:
53+
- openssh-server
54+
- postfix
55+
- curl
56+
- openssl
57+
- tzdata
58+
5059
# Optional settings.
5160
gitlab_time_zone: "UTC"
5261
gitlab_backup_keep_time: "604800"
@@ -59,11 +68,17 @@ gitlab_email_from: "[email protected]"
5968
gitlab_email_display_name: "Gitlab"
6069
gitlab_email_reply_to: "[email protected]"
6170

71+
# Registry configuration.
72+
gitlab_registry_enable: "false"
73+
gitlab_registry_external_url: "https://gitlab.example.com:4567"
74+
gitlab_registry_nginx_ssl_certificate: "/etc/gitlab/ssl/gitlab.crt"
75+
gitlab_registry_nginx_ssl_certificate_key: "/etc/gitlab/ssl/gitlab.key"
76+
6277
# LetsEncrypt configuration.
6378
gitlab_letsencrypt_enable: "false"
6479
gitlab_letsencrypt_contact_emails:
6580
6681
gitlab_letsencrypt_auto_renew_hour: 1
6782
gitlab_letsencrypt_auto_renew_minute: 30
6883
gitlab_letsencrypt_auto_renew_day_of_month: "*/7"
69-
gitlab_letsencrypt_auto_renew: true
84+
gitlab_letsencrypt_auto_renew: true

handlers/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
- name: restart gitlab
33
command: gitlab-ctl reconfigure
44
register: gitlab_restart
5-
failed_when: gitlab_restart_handler_failed_when
5+
failed_when: gitlab_restart_handler_failed_when | bool

meta/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
dependencies: []
33

44
galaxy_info:
5+
role_name: gitlab
56
author: geerlingguy
67
description: GitLab Git web interface
78
company: "Midwestern Mac, LLC"

tasks/main.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@
1313
# Install GitLab and its dependencies.
1414
- name: Install GitLab dependencies.
1515
package:
16-
name:
17-
- openssh-server
18-
- postfix
19-
- curl
20-
- openssl
21-
- tzdata
16+
name: "{{ gitlab_dependencies }}"
2217
state: present
2318

2419
- name: Install GitLab dependencies (Debian).
@@ -48,6 +43,8 @@
4843
package:
4944
name: "{{ gitlab_package_name | default(gitlab_edition) }}"
5045
state: present
46+
async: 300
47+
poll: 5
5148
when: not gitlab_file.stat.exists
5249

5350
# Start and configure GitLab. Sometimes the first run fails, but after that,

templates/gitlab.rb.j2

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ gitlab_rails['backup_path'] = "{{ gitlab_backup_path }}"
3737
# These settings are documented in more detail at
3838
# https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/gitlab.yml.example#L118
3939
gitlab_rails['ldap_enabled'] = {{ gitlab_ldap_enabled }}
40+
{% if gitlab_ldap_enabled == "true" %}
4041
gitlab_rails['ldap_host'] = '{{ gitlab_ldap_host }}'
4142
gitlab_rails['ldap_port'] = {{ gitlab_ldap_port }}
4243
gitlab_rails['ldap_uid'] = '{{ gitlab_ldap_uid }}'
@@ -45,6 +46,7 @@ gitlab_rails['ldap_bind_dn'] = '{{ gitlab_ldap_bind_dn }}'
4546
gitlab_rails['ldap_password'] = '{{ gitlab_ldap_password }}'
4647
gitlab_rails['ldap_allow_username_or_email_login'] = true
4748
gitlab_rails['ldap_base'] = '{{ gitlab_ldap_base }}'
49+
{% endif %}
4850

4951
# GitLab Nginx
5052
## See https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md
@@ -59,17 +61,25 @@ nginx['listen_https'] = {{ gitlab_nginx_listen_https }}
5961
# More details and example configuration at
6062
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md
6163
gitlab_rails['smtp_enable'] = {{ gitlab_smtp_enable }}
64+
{% if gitlab_smtp_enable == "true" %}
6265
gitlab_rails['smtp_address'] = '{{ gitlab_smtp_address }}'
6366
gitlab_rails['smtp_port'] = {{ gitlab_smtp_port }}
67+
{% if gitlab_smtp_user_name %}
6468
gitlab_rails['smtp_user_name'] = '{{ gitlab_smtp_user_name }}'
69+
{% endif %}
70+
{% if gitlab_smtp_password %}
6571
gitlab_rails['smtp_password'] = '{{ gitlab_smtp_password }}'
72+
{% endif %}
6673
gitlab_rails['smtp_domain'] = '{{ gitlab_smtp_domain }}'
74+
{% if gitlab_smtp_authentication %}
6775
gitlab_rails['smtp_authentication'] = '{{ gitlab_smtp_authentication }}'
76+
{% endif %}
6877
gitlab_rails['smtp_enable_starttls_auto'] = {{ gitlab_smtp_enable_starttls_auto }}
6978
gitlab_rails['smtp_tls'] = {{ gitlab_smtp_tls }}
7079
gitlab_rails['smtp_openssl_verify_mode'] = '{{ gitlab_smtp_openssl_verify_mode }}'
7180
gitlab_rails['smtp_ca_path'] = '{{ gitlab_smtp_ca_path }}'
7281
gitlab_rails['smtp_ca_file'] = '{{ gitlab_smtp_ca_file }}'
82+
{% endif %}
7383

7484
# 2-way SSL Client Authentication.
7585
{% if gitlab_nginx_ssl_verify_client %}
@@ -79,5 +89,29 @@ nginx['ssl_verify_client'] = "{{ gitlab_nginx_ssl_verify_client }}"
7989
nginx['ssl_client_certificate'] = "{{ gitlab_nginx_ssl_client_certificate }}"
8090
{% endif %}
8191

92+
# GitLab registry.
93+
registry['enable'] = {{ gitlab_registry_enable }}
94+
{% if gitlab_registry_enable %}
95+
registry_external_url "{{ gitlab_registry_external_url }}"
96+
registry_nginx['ssl_certificate'] = "{{ gitlab_registry_nginx_ssl_certificate }}"
97+
registry_nginx['ssl_certificate_key'] = "{{ gitlab_registry_nginx_ssl_certificate_key }}"
98+
{% endif %}
99+
100+
{% if gitlab_extra_settings is defined %}
101+
# Extra configuration
102+
{% for extra in gitlab_extra_settings %}
103+
{% for setting in extra %}
104+
{% for kv in extra[setting] %}
105+
{% if (kv.type is defined and kv.type == 'plain') or (kv.value is not string) %}
106+
{{ setting }}['{{ kv.key }}'] = {{ kv.value }}
107+
{% else %}
108+
{{ setting }}['{{ kv.key }}'] = '{{ kv.value }}'
109+
{% endif %}
110+
{% endfor %}
111+
{% endfor %}
112+
113+
{% endfor %}
114+
{% endif %}
115+
82116
# To change other settings, see:
83117
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#changing-gitlab-yml-settings

0 commit comments

Comments
 (0)