WIP3
This commit is contained in:
4
roles/geerlingguy.gitlab/.github/FUNDING.yml
vendored
Normal file
4
roles/geerlingguy.gitlab/.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# These are supported funding model platforms
|
||||
---
|
||||
github: geerlingguy
|
||||
patreon: geerlingguy
|
||||
56
roles/geerlingguy.gitlab/.github/stale.yml
vendored
Normal file
56
roles/geerlingguy.gitlab/.github/stale.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||
daysUntilStale: 90
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
|
||||
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
||||
daysUntilClose: 30
|
||||
|
||||
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
|
||||
onlyLabels: []
|
||||
|
||||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
- planned
|
||||
|
||||
# Set to true to ignore issues in a project (defaults to false)
|
||||
exemptProjects: false
|
||||
|
||||
# Set to true to ignore issues in a milestone (defaults to false)
|
||||
exemptMilestones: false
|
||||
|
||||
# Set to true to ignore issues with an assignee (defaults to false)
|
||||
exemptAssignees: false
|
||||
|
||||
# Label to use when marking as stale
|
||||
staleLabel: stale
|
||||
|
||||
# Limit the number of actions per hour, from 1-30. Default is 30
|
||||
limitPerRun: 30
|
||||
|
||||
pulls:
|
||||
markComment: |-
|
||||
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
|
||||
|
||||
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark pull requests as stale.
|
||||
|
||||
unmarkComment: >-
|
||||
This pull request is no longer marked for closure.
|
||||
|
||||
closeComment: >-
|
||||
This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details.
|
||||
|
||||
issues:
|
||||
markComment: |-
|
||||
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
|
||||
|
||||
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
|
||||
|
||||
unmarkComment: >-
|
||||
This issue is no longer marked for closure.
|
||||
|
||||
closeComment: >-
|
||||
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
|
||||
3
roles/geerlingguy.gitlab/.gitignore
vendored
Normal file
3
roles/geerlingguy.gitlab/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.retry
|
||||
*/__pycache__
|
||||
*.pyc
|
||||
32
roles/geerlingguy.gitlab/.travis.yml
Normal file
32
roles/geerlingguy.gitlab/.travis.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
language: python
|
||||
services: docker
|
||||
|
||||
env:
|
||||
global:
|
||||
- ROLE_NAME: gitlab
|
||||
matrix:
|
||||
- MOLECULE_DISTRO: centos7
|
||||
- MOLECULE_DISTRO: ubuntu1804
|
||||
- MOLECULE_DISTRO: debian9
|
||||
- MOLECULE_DISTRO: centos7
|
||||
MOLECULE_PLAYBOOK: playbook-version.yml
|
||||
- MOLECULE_DISTRO: ubuntu1804
|
||||
MOLECULE_PLAYBOOK: playbook-version.yml
|
||||
|
||||
install:
|
||||
# Install test dependencies.
|
||||
- pip install molecule yamllint ansible-lint docker
|
||||
|
||||
before_script:
|
||||
# Use actual Ansible Galaxy role name for the project directory.
|
||||
- cd ../
|
||||
- mv ansible-role-$ROLE_NAME geerlingguy.$ROLE_NAME
|
||||
- cd geerlingguy.$ROLE_NAME
|
||||
|
||||
script:
|
||||
# Run tests.
|
||||
- molecule test
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||
6
roles/geerlingguy.gitlab/.yamllint
Normal file
6
roles/geerlingguy.gitlab/.yamllint
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
extends: default
|
||||
rules:
|
||||
line-length:
|
||||
max: 140
|
||||
level: warning
|
||||
20
roles/geerlingguy.gitlab/LICENSE
Normal file
20
roles/geerlingguy.gitlab/LICENSE
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Jeff Geerling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
179
roles/geerlingguy.gitlab/README.md
Normal file
179
roles/geerlingguy.gitlab/README.md
Normal file
@@ -0,0 +1,179 @@
|
||||
# Ansible Role: GitLab
|
||||
|
||||
[](https://travis-ci.org/geerlingguy/ansible-role-gitlab)
|
||||
|
||||
Installs GitLab, a Ruby-based front-end to Git, on any RedHat/CentOS or Debian/Ubuntu linux system.
|
||||
|
||||
GitLab's default administrator account details are below; be sure to login immediately after installation and change these credentials!
|
||||
|
||||
root
|
||||
5iveL!fe
|
||||
|
||||
## Requirements
|
||||
|
||||
None.
|
||||
|
||||
## Role Variables
|
||||
|
||||
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
||||
|
||||
gitlab_domain: gitlab
|
||||
gitlab_external_url: "https://{{ gitlab_domain }}/"
|
||||
|
||||
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).
|
||||
|
||||
gitlab_git_data_dir: "/var/opt/gitlab/git-data"
|
||||
|
||||
The `gitlab_git_data_dir` is the location where all the Git repositories will be stored. You can use a shared drive or any path on the system.
|
||||
|
||||
gitlab_backup_path: "/var/opt/gitlab/backups"
|
||||
|
||||
The `gitlab_backup_path` is the location where Gitlab backups will be stored.
|
||||
|
||||
gitlab_edition: "gitlab-ce"
|
||||
|
||||
The edition of GitLab to install. Usually either `gitlab-ce` (Community Edition) or `gitlab-ee` (Enterprise Edition).
|
||||
|
||||
gitlab_version: ''
|
||||
|
||||
If you'd like to install a specific version, set the version here (e.g. `11.4.0-ce.0` for Debian/Ubuntu, or `11.4.0-ce.0.el7` for RedHat/CentOS).
|
||||
|
||||
gitlab_config_template: "gitlab.rb.j2"
|
||||
|
||||
The `gitlab.rb.j2` template packaged with this role is meant to be very generic and serve a variety of use cases. However, many people would like to have a much more customized version, and so you can override this role's default template with your own, adding any additional customizations you need. To do this:
|
||||
|
||||
- Create a `templates` directory at the same level as your playbook.
|
||||
- Create a `templates\mygitlab.rb.j2` file (just choose a different name from the default template).
|
||||
- Set the variable like: `gitlab_config_template: mygitlab.rb.j2` (with the name of your custom template).
|
||||
|
||||
### SSL Configuration.
|
||||
|
||||
gitlab_redirect_http_to_https: "true"
|
||||
gitlab_ssl_certificate: "/etc/gitlab/ssl/{{ gitlab_domain }}.crt"
|
||||
gitlab_ssl_certificate_key: "/etc/gitlab/ssl/{{ gitlab_domain }}.key"
|
||||
|
||||
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).
|
||||
|
||||
# SSL Self-signed Certificate Configuration.
|
||||
gitlab_create_self_signed_cert: "true"
|
||||
gitlab_self_signed_cert_subj: "/C=US/ST=Missouri/L=Saint Louis/O=IT/CN={{ gitlab_domain }}"
|
||||
|
||||
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.
|
||||
|
||||
# LDAP Configuration.
|
||||
gitlab_ldap_enabled: "false"
|
||||
gitlab_ldap_host: "example.com"
|
||||
gitlab_ldap_port: "389"
|
||||
gitlab_ldap_uid: "sAMAccountName"
|
||||
gitlab_ldap_method: "plain"
|
||||
gitlab_ldap_bind_dn: "CN=Username,CN=Users,DC=example,DC=com"
|
||||
gitlab_ldap_password: "password"
|
||||
gitlab_ldap_base: "DC=example,DC=com"
|
||||
|
||||
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.
|
||||
|
||||
gitlab_dependencies:
|
||||
- openssh-server
|
||||
- postfix
|
||||
- curl
|
||||
- openssl
|
||||
- tzdata
|
||||
|
||||
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`.
|
||||
|
||||
gitlab_time_zone: "UTC"
|
||||
|
||||
Gitlab timezone.
|
||||
|
||||
gitlab_backup_keep_time: "604800"
|
||||
|
||||
How long to keep local backups (useful if you don't want backups to fill up your drive!).
|
||||
|
||||
gitlab_download_validate_certs: true
|
||||
|
||||
Controls whether to validate certificates when downloading the GitLab installation repository install script.
|
||||
|
||||
# Email configuration.
|
||||
gitlab_email_enabled: "false"
|
||||
gitlab_email_from: "gitlab@example.com"
|
||||
gitlab_email_display_name: "Gitlab"
|
||||
gitlab_email_reply_to: "gitlab@example.com"
|
||||
|
||||
Gitlab system mail configuration. Disabled by default; set `gitlab_email_enabled` to `true` to enable, and make sure you enter valid from/reply-to values.
|
||||
|
||||
# SMTP Configuration
|
||||
gitlab_smtp_enable: "false"
|
||||
gitlab_smtp_address: "smtp.server"
|
||||
gitlab_smtp_port: "465"
|
||||
gitlab_smtp_user_name: "smtp user"
|
||||
gitlab_smtp_password: "smtp password"
|
||||
gitlab_smtp_domain: "example.com"
|
||||
gitlab_smtp_authentication: "login"
|
||||
gitlab_smtp_enable_starttls_auto: "true"
|
||||
gitlab_smtp_tls: "false"
|
||||
gitlab_smtp_openssl_verify_mode: "none"
|
||||
gitlab_smtp_ca_path: "/etc/ssl/certs"
|
||||
gitlab_smtp_ca_file: "/etc/ssl/certs/ca-certificates.crt"
|
||||
|
||||
Gitlab SMTP configuration; of `gitlab_smtp_enable` is `true`, the rest of the configuration will tell GitLab how to send mails using an smtp server.
|
||||
|
||||
gitlab_nginx_listen_port: 8080
|
||||
|
||||
If you are running GitLab behind a reverse proxy, you may want to override the listen port to something else.
|
||||
|
||||
gitlab_nginx_listen_https: "false"
|
||||
|
||||
If you are running GitLab behind a reverse proxy, you may wish to terminate SSL at another proxy server or load balancer
|
||||
|
||||
gitlab_nginx_ssl_verify_client: ""
|
||||
gitlab_nginx_ssl_client_certificate: ""
|
||||
|
||||
If you want to enable [2-way SSL Client Authentication](https://docs.gitlab.com/omnibus/settings/nginx.html#enable-2-way-ssl-client-authentication), set `gitlab_nginx_ssl_verify_client` and add a path to the client certificate in `gitlab_nginx_ssl_client_certificate`.
|
||||
|
||||
gitlab_default_theme: 2
|
||||
|
||||
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).
|
||||
|
||||
gitlab_extra_settings:
|
||||
- gitlab_rails:
|
||||
- key: "trusted_proxies"
|
||||
value: "['foo', 'bar']"
|
||||
- key: "env"
|
||||
type: "plain"
|
||||
value: |
|
||||
{
|
||||
"http_proxy" => "https://my_http_proxy.company.com:3128",
|
||||
"https_proxy" => "https://my_http_proxy.company.com:3128",
|
||||
"no_proxy" => "localhost, 127.0.0.1, company.com"
|
||||
}
|
||||
- unicorn:
|
||||
- key: "worker_processes"
|
||||
value: 5
|
||||
- key: "pidfile"
|
||||
value: "/opt/gitlab/var/unicorn/unicorn.pid"
|
||||
|
||||
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.
|
||||
|
||||
## Dependencies
|
||||
|
||||
None.
|
||||
|
||||
## Example Playbook
|
||||
|
||||
- hosts: servers
|
||||
vars_files:
|
||||
- vars/main.yml
|
||||
roles:
|
||||
- { role: geerlingguy.gitlab }
|
||||
|
||||
*Inside `vars/main.yml`*:
|
||||
|
||||
gitlab_external_url: "https://gitlab.example.com/"
|
||||
|
||||
## License
|
||||
|
||||
MIT / BSD
|
||||
|
||||
## Author Information
|
||||
|
||||
This role was created in 2014 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/).
|
||||
75
roles/geerlingguy.gitlab/defaults/main.yml
Normal file
75
roles/geerlingguy.gitlab/defaults/main.yml
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
# General config.
|
||||
gitlab_domain: gitlab
|
||||
gitlab_external_url: "https://{{ gitlab_domain }}/"
|
||||
gitlab_git_data_dir: "/var/opt/gitlab/git-data"
|
||||
gitlab_edition: "gitlab-ce"
|
||||
gitlab_version: ''
|
||||
gitlab_backup_path: "/var/opt/gitlab/backups"
|
||||
gitlab_config_template: "gitlab.rb.j2"
|
||||
|
||||
# SSL Configuration.
|
||||
gitlab_redirect_http_to_https: "true"
|
||||
gitlab_ssl_certificate: "/etc/gitlab/ssl/{{ gitlab_domain }}.crt"
|
||||
gitlab_ssl_certificate_key: "/etc/gitlab/ssl/{{ gitlab_domain }}.key"
|
||||
|
||||
# SSL Self-signed Certificate Configuration.
|
||||
gitlab_create_self_signed_cert: "true"
|
||||
gitlab_self_signed_cert_subj: "/C=US/ST=Missouri/L=Saint Louis/O=IT/CN={{ gitlab_domain }}"
|
||||
|
||||
# LDAP Configuration.
|
||||
gitlab_ldap_enabled: "false"
|
||||
gitlab_ldap_host: "example.com"
|
||||
gitlab_ldap_port: "389"
|
||||
gitlab_ldap_uid: "sAMAccountName"
|
||||
gitlab_ldap_method: "plain"
|
||||
gitlab_ldap_bind_dn: "CN=Username,CN=Users,DC=example,DC=com"
|
||||
gitlab_ldap_password: "password"
|
||||
gitlab_ldap_base: "DC=example,DC=com"
|
||||
|
||||
# SMTP Configuration
|
||||
gitlab_smtp_enable: "false"
|
||||
gitlab_smtp_address: "smtp.server"
|
||||
gitlab_smtp_port: "465"
|
||||
gitlab_smtp_user_name: "smtp user"
|
||||
gitlab_smtp_password: "smtp password"
|
||||
gitlab_smtp_domain: "example.com"
|
||||
gitlab_smtp_authentication: "login"
|
||||
gitlab_smtp_enable_starttls_auto: "true"
|
||||
gitlab_smtp_tls: "false"
|
||||
gitlab_smtp_openssl_verify_mode: "none"
|
||||
gitlab_smtp_ca_path: "/etc/ssl/certs"
|
||||
gitlab_smtp_ca_file: "/etc/ssl/certs/ca-certificates.crt"
|
||||
|
||||
# 2-way SSL Client Authentication support.
|
||||
gitlab_nginx_ssl_verify_client: ""
|
||||
gitlab_nginx_ssl_client_certificate: ""
|
||||
|
||||
# Probably best to leave this as the default, unless doing testing.
|
||||
gitlab_restart_handler_failed_when: 'gitlab_restart.rc != 0'
|
||||
|
||||
# Dependencies.
|
||||
gitlab_dependencies:
|
||||
- openssh-server
|
||||
- postfix
|
||||
- curl
|
||||
- openssl
|
||||
- tzdata
|
||||
|
||||
# Optional settings.
|
||||
gitlab_time_zone: "UTC"
|
||||
gitlab_backup_keep_time: "604800"
|
||||
gitlab_download_validate_certs: true
|
||||
gitlab_default_theme: '2'
|
||||
|
||||
# Email configuration.
|
||||
gitlab_email_enabled: "false"
|
||||
gitlab_email_from: "gitlab@example.com"
|
||||
gitlab_email_display_name: "Gitlab"
|
||||
gitlab_email_reply_to: "gitlab@example.com"
|
||||
|
||||
# Registry configuration.
|
||||
gitlab_registry_enable: "false"
|
||||
gitlab_registry_external_url: "https://gitlab.example.com:4567"
|
||||
gitlab_registry_nginx_ssl_certificate: "/etc/gitlab/ssl/gitlab.crt"
|
||||
gitlab_registry_nginx_ssl_certificate_key: "/etc/gitlab/ssl/gitlab.key"
|
||||
5
roles/geerlingguy.gitlab/handlers/main.yml
Normal file
5
roles/geerlingguy.gitlab/handlers/main.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: restart gitlab
|
||||
command: gitlab-ctl reconfigure
|
||||
register: gitlab_restart
|
||||
failed_when: gitlab_restart_handler_failed_when | bool
|
||||
2
roles/geerlingguy.gitlab/meta/.galaxy_install_info
Normal file
2
roles/geerlingguy.gitlab/meta/.galaxy_install_info
Normal file
@@ -0,0 +1,2 @@
|
||||
install_date: Wed Jun 24 18:44:32 2020
|
||||
version: 3.0.0
|
||||
28
roles/geerlingguy.gitlab/meta/main.yml
Normal file
28
roles/geerlingguy.gitlab/meta/main.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
dependencies: []
|
||||
|
||||
galaxy_info:
|
||||
author: geerlingguy
|
||||
description: GitLab Git web interface
|
||||
company: "Midwestern Mac, LLC"
|
||||
license: "license (BSD, MIT)"
|
||||
min_ansible_version: 2.0
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 6
|
||||
- 7
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags:
|
||||
- development
|
||||
- web
|
||||
- gitlab
|
||||
- git
|
||||
- repository
|
||||
- ci
|
||||
- integration
|
||||
21
roles/geerlingguy.gitlab/molecule/default/converge.yml
Normal file
21
roles/geerlingguy.gitlab/molecule/default/converge.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
become: true
|
||||
|
||||
vars:
|
||||
gitlab_restart_handler_failed_when: false
|
||||
|
||||
pre_tasks:
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=true cache_valid_time=600
|
||||
when: ansible_os_family == 'Debian'
|
||||
changed_when: false
|
||||
|
||||
- name: Remove the .dockerenv file so GitLab Omnibus doesn't get confused.
|
||||
file:
|
||||
path: /.dockerenv
|
||||
state: absent
|
||||
|
||||
roles:
|
||||
- role: geerlingguy.gitlab
|
||||
21
roles/geerlingguy.gitlab/molecule/default/molecule.yml
Normal file
21
roles/geerlingguy.gitlab/molecule/default/molecule.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
driver:
|
||||
name: docker
|
||||
lint: |
|
||||
set -e
|
||||
yamllint .
|
||||
ansible-lint
|
||||
platforms:
|
||||
- name: instance
|
||||
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
|
||||
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
privileged: true
|
||||
pre_build_image: true
|
||||
provisioner:
|
||||
name: ansible
|
||||
playbooks:
|
||||
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
become: true
|
||||
|
||||
vars:
|
||||
gitlab_restart_handler_failed_when: false
|
||||
|
||||
pre_tasks:
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=true cache_valid_time=600
|
||||
when: ansible_os_family == 'Debian'
|
||||
changed_when: false
|
||||
|
||||
- name: Remove the .dockerenv file so GitLab Omnibus doesn't get confused.
|
||||
file:
|
||||
path: /.dockerenv
|
||||
state: absent
|
||||
|
||||
- name: Set the test GitLab version number for Debian.
|
||||
set_fact:
|
||||
gitlab_version: '11.4.0-ce.0'
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Set the test GitLab version number for RedHat.
|
||||
set_fact:
|
||||
gitlab_version: '11.4.0-ce.0.el7'
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
roles:
|
||||
- role: geerlingguy.gitlab
|
||||
81
roles/geerlingguy.gitlab/tasks/main.yml
Normal file
81
roles/geerlingguy.gitlab/tasks/main.yml
Normal file
@@ -0,0 +1,81 @@
|
||||
---
|
||||
- name: Include OS-specific variables.
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
|
||||
- name: Check if GitLab configuration file already exists.
|
||||
stat: path=/etc/gitlab/gitlab.rb
|
||||
register: gitlab_config_file
|
||||
|
||||
- name: Check if GitLab is already installed.
|
||||
stat: path=/usr/bin/gitlab-ctl
|
||||
register: gitlab_file
|
||||
|
||||
# Install GitLab and its dependencies.
|
||||
- name: Install GitLab dependencies.
|
||||
package:
|
||||
name: "{{ gitlab_dependencies }}"
|
||||
state: present
|
||||
|
||||
- name: Install GitLab dependencies (Debian).
|
||||
apt:
|
||||
name: gnupg2
|
||||
state: present
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Download GitLab repository installation script.
|
||||
get_url:
|
||||
url: "{{ gitlab_repository_installation_script_url }}"
|
||||
dest: /tmp/gitlab_install_repository.sh
|
||||
validate_certs: "{{ gitlab_download_validate_certs }}"
|
||||
when: not gitlab_file.stat.exists
|
||||
|
||||
- name: Install GitLab repository.
|
||||
command: bash /tmp/gitlab_install_repository.sh
|
||||
register: output
|
||||
when: not gitlab_file.stat.exists
|
||||
|
||||
- name: Define the Gitlab package name.
|
||||
set_fact:
|
||||
gitlab_package_name: "{{ gitlab_edition }}{{ gitlab_package_version_separator }}{{ gitlab_version }}"
|
||||
when: gitlab_version | default(false)
|
||||
|
||||
- name: Install GitLab
|
||||
package:
|
||||
name: "{{ gitlab_package_name | default(gitlab_edition) }}"
|
||||
state: present
|
||||
async: 300
|
||||
poll: 5
|
||||
when: not gitlab_file.stat.exists
|
||||
|
||||
# Start and configure GitLab. Sometimes the first run fails, but after that,
|
||||
# restarts fix problems, so ignore failures on this run.
|
||||
- name: Reconfigure GitLab (first run).
|
||||
command: >
|
||||
gitlab-ctl reconfigure
|
||||
creates=/var/opt/gitlab/bootstrapped
|
||||
failed_when: false
|
||||
|
||||
- name: Create GitLab SSL configuration folder.
|
||||
file:
|
||||
path: /etc/gitlab/ssl
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0700
|
||||
when: gitlab_create_self_signed_cert
|
||||
|
||||
- name: Create self-signed certificate.
|
||||
command: >
|
||||
openssl req -new -nodes -x509 -subj "{{ gitlab_self_signed_cert_subj }}"
|
||||
-days 3650 -keyout {{ gitlab_ssl_certificate_key }} -out {{ gitlab_ssl_certificate }} -extensions v3_ca
|
||||
creates={{ gitlab_ssl_certificate }}
|
||||
when: gitlab_create_self_signed_cert
|
||||
|
||||
- name: Copy GitLab configuration file.
|
||||
template:
|
||||
src: "{{ gitlab_config_template }}"
|
||||
dest: /etc/gitlab/gitlab.rb
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
notify: restart gitlab
|
||||
108
roles/geerlingguy.gitlab/templates/gitlab.rb.j2
Normal file
108
roles/geerlingguy.gitlab/templates/gitlab.rb.j2
Normal file
@@ -0,0 +1,108 @@
|
||||
# The URL through which GitLab will be accessed.
|
||||
external_url "{{ gitlab_external_url }}"
|
||||
|
||||
# gitlab.yml configuration
|
||||
gitlab_rails['time_zone'] = "{{ gitlab_time_zone }}"
|
||||
gitlab_rails['backup_keep_time'] = {{ gitlab_backup_keep_time }}
|
||||
gitlab_rails['gitlab_email_enabled'] = {{ gitlab_email_enabled }}
|
||||
{% if gitlab_email_enabled == "true" %}
|
||||
gitlab_rails['gitlab_email_from'] = "{{ gitlab_email_from }}"
|
||||
gitlab_rails['gitlab_email_display_name'] = "{{ gitlab_email_display_name }}"
|
||||
gitlab_rails['gitlab_email_reply_to'] = "{{ gitlab_email_reply_to }}"
|
||||
{% endif %}
|
||||
|
||||
# Default Theme
|
||||
gitlab_rails['gitlab_default_theme'] = "{{ gitlab_default_theme }}"
|
||||
|
||||
# Whether to redirect http to https.
|
||||
nginx['redirect_http_to_https'] = {{ gitlab_redirect_http_to_https }}
|
||||
nginx['ssl_certificate'] = "{{ gitlab_ssl_certificate }}"
|
||||
nginx['ssl_certificate_key'] = "{{ gitlab_ssl_certificate_key }}"
|
||||
|
||||
# The directory where Git repositories will be stored.
|
||||
git_data_dirs({"default" => {"path" => "{{ gitlab_git_data_dir }}"} })
|
||||
|
||||
# The directory where Gitlab backups will be stored
|
||||
gitlab_rails['backup_path'] = "{{ gitlab_backup_path }}"
|
||||
|
||||
# These settings are documented in more detail at
|
||||
# https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/gitlab.yml.example#L118
|
||||
gitlab_rails['ldap_enabled'] = {{ gitlab_ldap_enabled }}
|
||||
{% if gitlab_ldap_enabled == "true" %}
|
||||
gitlab_rails['ldap_host'] = '{{ gitlab_ldap_host }}'
|
||||
gitlab_rails['ldap_port'] = {{ gitlab_ldap_port }}
|
||||
gitlab_rails['ldap_uid'] = '{{ gitlab_ldap_uid }}'
|
||||
gitlab_rails['ldap_method'] = '{{ gitlab_ldap_method}}' # 'ssl' or 'plain'
|
||||
gitlab_rails['ldap_bind_dn'] = '{{ gitlab_ldap_bind_dn }}'
|
||||
gitlab_rails['ldap_password'] = '{{ gitlab_ldap_password }}'
|
||||
gitlab_rails['ldap_allow_username_or_email_login'] = true
|
||||
gitlab_rails['ldap_base'] = '{{ gitlab_ldap_base }}'
|
||||
{% endif %}
|
||||
|
||||
# GitLab Nginx
|
||||
## See https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md
|
||||
{% if gitlab_nginx_listen_port is defined %}
|
||||
nginx['listen_port'] = "{{ gitlab_nginx_listen_port }}"
|
||||
{% endif %}
|
||||
{% if gitlab_nginx_listen_https is defined %}
|
||||
nginx['listen_https'] = {{ gitlab_nginx_listen_https }}
|
||||
{% endif %}
|
||||
|
||||
# Use smtp instead of sendmail/postfix
|
||||
# More details and example configuration at
|
||||
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md
|
||||
gitlab_rails['smtp_enable'] = {{ gitlab_smtp_enable }}
|
||||
{% if gitlab_smtp_enable == "true" %}
|
||||
gitlab_rails['smtp_address'] = '{{ gitlab_smtp_address }}'
|
||||
gitlab_rails['smtp_port'] = {{ gitlab_smtp_port }}
|
||||
{% if gitlab_smtp_user_name %}
|
||||
gitlab_rails['smtp_user_name'] = '{{ gitlab_smtp_user_name }}'
|
||||
{% endif %}
|
||||
{% if gitlab_smtp_password %}
|
||||
gitlab_rails['smtp_password'] = '{{ gitlab_smtp_password }}'
|
||||
{% endif %}
|
||||
gitlab_rails['smtp_domain'] = '{{ gitlab_smtp_domain }}'
|
||||
{% if gitlab_smtp_authentication %}
|
||||
gitlab_rails['smtp_authentication'] = '{{ gitlab_smtp_authentication }}'
|
||||
{% endif %}
|
||||
gitlab_rails['smtp_enable_starttls_auto'] = {{ gitlab_smtp_enable_starttls_auto }}
|
||||
gitlab_rails['smtp_tls'] = {{ gitlab_smtp_tls }}
|
||||
gitlab_rails['smtp_openssl_verify_mode'] = '{{ gitlab_smtp_openssl_verify_mode }}'
|
||||
gitlab_rails['smtp_ca_path'] = '{{ gitlab_smtp_ca_path }}'
|
||||
gitlab_rails['smtp_ca_file'] = '{{ gitlab_smtp_ca_file }}'
|
||||
{% endif %}
|
||||
|
||||
# 2-way SSL Client Authentication.
|
||||
{% if gitlab_nginx_ssl_verify_client %}
|
||||
nginx['ssl_verify_client'] = "{{ gitlab_nginx_ssl_verify_client }}"
|
||||
{% endif %}
|
||||
{% if gitlab_nginx_ssl_client_certificate %}
|
||||
nginx['ssl_client_certificate'] = "{{ gitlab_nginx_ssl_client_certificate }}"
|
||||
{% endif %}
|
||||
|
||||
# GitLab registry.
|
||||
registry['enable'] = {{ gitlab_registry_enable }}
|
||||
{% if gitlab_registry_enable %}
|
||||
registry_external_url "{{ gitlab_registry_external_url }}"
|
||||
registry_nginx['ssl_certificate'] = "{{ gitlab_registry_nginx_ssl_certificate }}"
|
||||
registry_nginx['ssl_certificate_key'] = "{{ gitlab_registry_nginx_ssl_certificate_key }}"
|
||||
{% endif %}
|
||||
|
||||
{% if gitlab_extra_settings is defined %}
|
||||
# Extra configuration
|
||||
{% for extra in gitlab_extra_settings %}
|
||||
{% for setting in extra %}
|
||||
{% for kv in extra[setting] %}
|
||||
{% if (kv.type is defined and kv.type == 'plain') or (kv.value is not string) %}
|
||||
{{ setting }}['{{ kv.key }}'] = {{ kv.value }}
|
||||
{% else %}
|
||||
{{ setting }}['{{ kv.key }}'] = '{{ kv.value }}'
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
# To change other settings, see:
|
||||
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#changing-gitlab-yml-settings
|
||||
3
roles/geerlingguy.gitlab/vars/Debian.yml
Normal file
3
roles/geerlingguy.gitlab/vars/Debian.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
gitlab_package_version_separator: '='
|
||||
gitlab_repository_installation_script_url: "https://packages.gitlab.com/install/repositories/gitlab/{{ gitlab_edition }}/script.deb.sh"
|
||||
3
roles/geerlingguy.gitlab/vars/RedHat.yml
Normal file
3
roles/geerlingguy.gitlab/vars/RedHat.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
gitlab_package_version_separator: '-'
|
||||
gitlab_repository_installation_script_url: "https://packages.gitlab.com/install/repositories/gitlab/{{ gitlab_edition }}/script.rpm.sh"
|
||||
Reference in New Issue
Block a user