Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #121 from Normo/106-role-name-prefix
Browse files Browse the repository at this point in the history
refactor: add role name prefix to variables
  • Loading branch information
Norman Ziegner authored Mar 13, 2024
2 parents 60ebe66 + db95ab0 commit dfe80c1
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 51 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,23 +179,23 @@ gitlab_backup_path: '/var/opt/gitlab/backups'
Set the port GitLab's web-server Nginx is listening on:
```yaml
nginx_listen_port: '80'
gitlab_nginx_listen_port: '80'
```
#### Does Web-Server Nginx accept HTTPS Requests?
Choose whether GitLab's web-server Nginx accepts HTTPS requests:
```yaml
nginx_listen_https: 'false'
gitlab_nginx_listen_https: 'false'
```
#### Does Web-Server Nginx Redirect HTTP Requests to HTTPS?
Choose whether GitLab's web-server Nginx redirects HTTP requests to HTTPS:
```yaml
nginx_redirect_http_to_https: 'false'
gitlab_nginx_redirect_http_to_https: 'false'
```
#### Set GitLab feature flags
Expand Down Expand Up @@ -233,7 +233,7 @@ gitlab_mattermost_only_context: 'false'
Set switch to `false` to enable external Redis instance:

```yaml
use_internal_redis: 'false'
gitlab_use_internal_redis: 'false'
```

#### Password to Authenticate Redis Services within Cluster
Expand All @@ -242,7 +242,7 @@ It is recommended to enable authentication for Redis Master and Redis Replicas
by providing the respective password:

```yaml
redis_password: 'changeme'
gitlab_redis_password: 'changeme'
```

_Caution: You have to use your own private and encrypted password here._
Expand All @@ -262,15 +262,15 @@ _Caution: You have to use your own private and encrypted password here._
Choose a name of the Redis Cluster for references:

```yaml
redis_cluster_name: 'redis-cluster'
gitlab_redis_cluster_name: 'redis-cluster'
```

#### List of IP addresses of Redis Sentinel Servers

Add a list of IP addresses of the involved Redis Sentinel servers:

```yaml
redis_sentinel_ips:
gitlab_redis_sentinel_ips:
- '192.168.33.11'
- '192.168.33.12'
- '192.168.33.13'
Expand All @@ -281,7 +281,7 @@ redis_sentinel_ips:
Choose port on which Redis Sentinel servers are listening:

```yaml
redis_sentinel_port: '26379'
gitlab_redis_sentinel_port: '26379'
```

#### Whitelist IP Address Range for Monitoring Redis Sentinel Servers
Expand All @@ -299,7 +299,7 @@ gitlab_ip_range: '{{ ansible_facts.default_ipv4.address }}/24'
Set switch to `false` to enable external Gitaly instance:

```yaml
use_internal_gitaly: 'false'
gitlab_use_internal_gitaly: 'false'
```

#### Path to GitLab Data Directory
Expand Down Expand Up @@ -335,15 +335,15 @@ _Caution: You have to use your own private and encrypted password here._
Specify IP address of the Gitaly instance:

```yaml
gitaly_instance_ip: '127.0.0.1'
gitlab_gitaly_instance_ip: '127.0.0.1'
```

#### Gitaly Port

Specify port of the Gitaly instance:

```yaml
gitaly_instance_port: '8075'
gitlab_gitaly_instance_port: '8075'
```

### Variables to be Set if External PostgreSQL Database is Used
Expand All @@ -353,23 +353,23 @@ gitaly_instance_port: '8075'
Set switch to `false` to enable external PostgreSQL Database instance:

```yaml
use_internal_postgresql: 'false'
gitlab_use_internal_postgresql: 'false'
```

#### IP Address of External PostgreSQL Database Instance

Set IP Address of PostgreSQL Database instance:

```yaml
postgresql_db_host: '127.0.0.1'
gitlab_postgresql_db_host: '127.0.0.1'
```

#### Password for External PostgreSQL Database Instance

Set password of PostgreSQL Database instance:

```yaml
postgresql_db_password: 'changeme'
gitlab_postgresql_db_password: 'changeme'
```

_Caution: You have to use your own private and encrypted password here._
Expand Down
28 changes: 14 additions & 14 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,44 +30,44 @@ gitlab_backup_keep_time: "604800"
# Backup directory
gitlab_backup_path: "/var/opt/gitlab/backups"
# Port for web-requests
nginx_listen_port: "80"
gitlab_nginx_listen_port: "80"
# Whether to use https
nginx_listen_https: "false"
gitlab_nginx_listen_https: "false"
# Whether to redirect to https
nginx_redirect_http_to_https: "false"
gitlab_nginx_redirect_http_to_https: "false"

# Whether to use GitLab Omnibus internal Redis
use_internal_redis: "true"
gitlab_use_internal_redis: "true"
# Password for authentication
redis_password: 'changeme'
gitlab_redis_password: 'changeme'
# Name of the Redis cluster
redis_cluster_name: 'redis-cluster'
gitlab_redis_cluster_name: 'redis-cluster'
# List of IP addresses of Redis Sentinel instances
redis_sentinel_ips: []
gitlab_redis_sentinel_ips: []
# Port on which Redis Sentinel instances are listening
redis_sentinel_port: "26379"
gitlab_redis_sentinel_port: "26379"
# GitLap IP address range
gitlab_ip_range: "{{ ansible_facts.default_ipv4.address }}/24"

# Whether to use GitLab Omnibus internal Gitaly
use_internal_gitaly: "true"
gitlab_use_internal_gitaly: "true"
# Data directory to use
gitlab_git_data_dir: "/var/opt/gitlab/git-data"
# Gitaly token
gitlab_gitaly_token: 'changeme'
# GitLab Shell token
gitlab_secret_token: 'changeme'
# IP address of the Gitaly instance
gitaly_instance_ip: "127.0.0.1"
gitlab_gitaly_instance_ip: "127.0.0.1"
# Port of the Gitaly instance
gitaly_instance_port: "8075"
gitlab_gitaly_instance_port: "8075"

# Whether to use GitLab Omnibus internal PostgreSQL database
use_internal_postgresql: "true"
gitlab_use_internal_postgresql: "true"
# External PostgreSQL database host IP / domain
postgresql_db_host: "127.0.0.1"
gitlab_postgresql_db_host: "127.0.0.1"
# External PostgreSQL database password
postgresql_db_password: "changeme"
gitlab_postgresql_db_password: "changeme"

# Whether to enable email
gitlab_email_enabled: "false"
Expand Down
4 changes: 2 additions & 2 deletions tasks/feature-flag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
- name: "Check if feature flag is already enabled for {{ gitlab_feature_flag.name }}"
ansible.builtin.command:
cmd: "gitlab-rails runner 'is_feature_enabled = Feature.enabled?(:{{ gitlab_feature_flag.name }}); puts is_feature_enabled'"
register: "is_feature_enabled"
register: "gitlab_is_feature_enabled"
changed_when: false

- name: "Enable or disable feature flag {{ gitlab_feature_flag.name }}"
ansible.builtin.command:
cmd: "gitlab-rails runner 'Feature.{{ 'enable' if gitlab_feature_flag.enabled else 'disable' }}(:{{ gitlab_feature_flag.name }})'"
changed_when: true
when: "(is_feature_enabled.stdout == 'true' and not gitlab_feature_flag.enabled) or (is_feature_enabled.stdout == 'false' and gitlab_feature_flag.enabled)"
when: "(gitlab_is_feature_enabled.stdout == 'true' and not gitlab_feature_flag.enabled) or (gitlab_is_feature_enabled.stdout == 'false' and gitlab_feature_flag.enabled)"

...
8 changes: 4 additions & 4 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
url: "{{ gitlab_gpg_key_url }}"
id: "{{ gitlab_gpg_key_id }}"
state: present
when: not is_initial_dryrun
when: not gitlab_is_initial_dryrun

- name: Add GitLab APT repository
ansible.builtin.apt_repository:
Expand All @@ -39,10 +39,10 @@
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
register: apt_cache
register: gitlab_apt_cache
check_mode: false
changed_when:
- apt_cache.cache_updated
- gitlab_apt_cache.cache_updated
- not ansible_check_mode

- name: "Install GitLab on RedHat Like OS"
Expand Down Expand Up @@ -129,7 +129,7 @@
state: "{{ 'present' if gitlab_version | length > 0 else 'latest' }}"
register: gitlab_install_output
notify: GitLab has been installed or upgraded
when: not is_initial_dryrun
when: not gitlab_is_initial_dryrun

rescue:

Expand Down
6 changes: 3 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@

- name: Determine if this is an initial dry-run
ansible.builtin.set_fact:
is_initial_dryrun: "{{ ansible_check_mode and not gitlab_rails_binary.stat.exists }}"
gitlab_is_initial_dryrun: "{{ ansible_check_mode and not gitlab_rails_binary.stat.exists }}"

- name: Check if a previous reconfigure had failed
ansible.builtin.stat:
path: /etc/gitlab/reconfigure_failed
register: reconfigure_failed
register: gitlab_reconfigure_failed

- name: Reconfigure GitLab
ansible.builtin.import_tasks: reconfigure.yml
become: yes
when: reconfigure_failed.stat.exists
when: gitlab_reconfigure_failed.stat.exists

- name: Install GitLab
ansible.builtin.import_tasks: install.yml
Expand Down
28 changes: 14 additions & 14 deletions templates/gitlab.rb.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ gitlab_rails['time_zone'] = "{{ gitlab_time_zone }}"
gitlab_rails['backup_keep_time'] = "{{ gitlab_backup_keep_time }}"
gitlab_rails['backup_path'] = "{{ gitlab_backup_path }}"

nginx['listen_port'] = "{{ nginx_listen_port }}"
nginx['listen_https'] = {{ nginx_listen_https }}
nginx['redirect_http_to_https'] = {{ nginx_redirect_http_to_https }}
nginx['listen_port'] = "{{ gitlab_nginx_listen_port }}"
nginx['listen_https'] = {{ gitlab_nginx_listen_https }}
nginx['redirect_http_to_https'] = {{ gitlab_nginx_redirect_http_to_https }}

{% if not use_internal_redis %}
{% if not gitlab_use_internal_redis %}
redis['enable'] = false
gitlab_rails['redis_password'] = "{{ redis_password }}"
redis['master_name'] = "{{ redis_cluster_name }}"
redis['master_password'] = "{{ redis_password }}"
gitlab_rails['redis_password'] = "{{ gitlab_redis_password }}"
redis['master_name'] = "{{ gitlab_redis_cluster_name }}"
redis['master_password'] = "{{ gitlab_redis_password }}"
gitlab_rails['redis_sentinels'] = [
{% for redis_sentinel_ip in redis_sentinel_ips %}
{ "host" => "{{ redis_sentinel_ip }}", "port" => "{{ redis_sentinel_port }}" },
{% for redis_sentinel_ip in gitlab_redis_sentinel_ips %}
{ "host" => "{{ redis_sentinel_ip }}", "port" => "{{ gitlab_redis_sentinel_port }}" },
{% endfor %}
]
{% if gitlab_redis_sentinel_password | default('') | length %}
Expand All @@ -30,14 +30,14 @@ gitlab_rails['redis_sentinels_password'] = "{{ gitlab_redis_sentinel_password }}
{% endif %}
gitlab_rails['monitoring_whitelist'] = ["{{ gitlab_ip_range }}"]

{% if use_internal_gitaly %}
{% if gitlab_use_internal_gitaly %}
git_data_dirs({"default" => {"path" => "{{ gitlab_git_data_dir }}"} })
{% else %}
gitaly['enable'] = false
gitlab_rails['gitaly_token'] = "{{ gitlab_gitaly_token }}"
gitlab_shell['secret_token'] = "{{ gitlab_secret_token }}"
git_data_dirs({
'default' => { 'gitaly_address' => 'tcp://{{ gitaly_instance_ip }}:{{ gitaly_instance_port }}' },
'default' => { 'gitaly_address' => 'tcp://{{ gitlab_gitaly_instance_ip }}:{{ gitlab_gitaly_instance_port }}' },
})
{% endif %}

Expand All @@ -47,14 +47,14 @@ gitlab_rails['smtp_enable'] = {{ gitlab_smtp_enable }}

registry['enable'] = {{ gitlab_registry_enable }}

{% if not use_internal_postgresql %}
{% if not gitlab_use_internal_postgresql %}
# Disable the bundled Omnibus provided PostgreSQL
postgresql['enable'] = false
# PostgreSQL connection details
gitlab_rails['db_adapter'] = 'postgresql'
gitlab_rails['db_encoding'] = 'unicode'
gitlab_rails['db_host'] = "{{ postgresql_db_host }}"
gitlab_rails['db_password'] = "{{ postgresql_db_password }}"
gitlab_rails['db_host'] = "{{ gitlab_postgresql_db_host }}"
gitlab_rails['db_password'] = "{{ gitlab_postgresql_db_password }}"
{% endif %}

{#
Expand Down

0 comments on commit dfe80c1

Please sign in to comment.