Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions molecule/gitlab/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ provisioner:
inventory:
host_vars:
instancegitlab:
gitlab_version: "17.11.2"
gitlab_release: "ce.0"
gitlab_edition: "gitlab-ce"
gitlab_ip_range: "0.0.0.0/0"
gitlab_additional_configurations:
Expand Down
13 changes: 10 additions & 3 deletions molecule/gitlab/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,22 @@
- name: "Assert that GitLab Omnibus package is installed"
ansible.builtin.assert:
that:
- "'{{ gitlab_edition }}' in ansible_facts.packages"
- "gitlab_edition in ansible_facts.packages"
when:
- "gitlab_edition is defined"

- name: "Set expected package version of GitLab"
ansible.builtin.set_fact:
gitlab_expected_package_version: "{{ gitlab_version }}-{{ gitlab_release }}"
when:
- "gitlab_edition is defined"
- "gitlab_version is defined"
- "gitlab_release is defined"

- name: "Assert that installed GitLab version is equal to the desired one"
ansible.builtin.assert:
that:
- "ansible_facts.packages['{{ gitlab_edition }}'][0].version == gitlab_version"
- "ansible_facts.packages['{{ gitlab_edition }}'][0].release == gitlab_release"
- "ansible_facts.packages[gitlab_edition][0].version == gitlab_expected_package_version"
when:
- "gitlab_edition is defined"
- "gitlab_version is defined"
Expand Down
3 changes: 3 additions & 0 deletions roles/gitlab/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,7 @@ gitlab_mattermost_only_context: "false"

gitlab_feature_flags: []

# Internal variable to determine whether the configuration object for Gitaly
# is already present in gitlab_additional_configurations
__gitaly_configuration_exists: false
...
25 changes: 25 additions & 0 deletions roles/gitlab/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,31 @@
- "Reconfigure Primary GitLab"
- "Reconfigure Non Primary GitLab"

- name: "Ensure gitaly['configuration'] is not present in gitlab_additional_configurations"
when: "gitlab_use_internal_gitaly"
block:
- name: "Check if gitaly is present"
when:
- "gitlab_additional_configurations | length > 0"
- "item.gitaly is defined"
ansible.builtin.set_fact:
__gitaly_item: "{{ item.gitaly }}"
with_items: "{{ gitlab_additional_configurations }}"

- name: "Check if gitaly['configuration'] is present"
when:
- "item.key is defined"
- "item.key == 'configuration'"
ansible.builtin.set_fact:
__gitaly_configuration_exists: true
with_items: "{{ __gitaly_item | default([]) }}"

- name: "Warn if gitaly['configuration'] is already present"
when:
- "__gitaly_configuration_exists"
ansible.builtin.debug:
msg: "Please make sure to configure gitaly storage paths yourself in gitaly['configuration']"

- name: "Copy GitLab Configuration File."
become: true
ansible.builtin.template:
Expand Down
19 changes: 15 additions & 4 deletions roles/gitlab/templates/gitlab.rb.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,25 @@ gitlab_rails['redis_sentinels_password'] = "{{ gitlab_redis_sentinel_password }}
gitlab_rails['monitoring_whitelist'] = ["{{ gitlab_ip_range }}"]

{% if gitlab_use_internal_gitaly %}
git_data_dirs({"default" => {"path" => "{{ gitlab_git_data_dir }}"} })
{% if not __gitaly_configuration_exists %}
gitaly['configuration'] = {
"storage": [
{
"name": "default",
"path": "{{ (gitlab_git_data_dir, 'repositories') | path_join }}",
},
],
}
{% endif %}
{% 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://{{ gitlab_gitaly_instance_ip }}:{{ gitlab_gitaly_instance_port }}' },
})
gitlab_rails['repositories_storages'] = {
"default" => {
"gitaly_address" => "tcp://{{ gitlab_gitaly_instance_ip }}:{{ gitlab_gitaly_instance_port }}"
}
}
{% endif %}

gitlab_rails['gitlab_email_enabled'] = {{ gitlab_email_enabled }}
Expand Down