From b8ea1c51a15bf87924723bf64a258435897be4ff Mon Sep 17 00:00:00 2001 From: nazunalika Date: Mon, 28 Dec 2020 20:43:17 -0700 Subject: [PATCH] gitlab external database prep --- ansible/playbooks/tasks/gitlab-reconfigure.yml | 2 +- ansible/playbooks/templates/etc/gitlab/rocky_gitlab.rb | 10 ++++++++++ ansible/playbooks/vars/gitlab.yml | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ansible/playbooks/tasks/gitlab-reconfigure.yml b/ansible/playbooks/tasks/gitlab-reconfigure.yml index f817ed6..3520168 100644 --- a/ansible/playbooks/tasks/gitlab-reconfigure.yml +++ b/ansible/playbooks/tasks/gitlab-reconfigure.yml @@ -69,7 +69,7 @@ - name: Apply fcontext to GitLab unix socket for nginx command: restorecon -v /var/opt/gitlab/gitlab-workhorse/sockets/socket register: restorecon_result - changed_when: "restorecon_result == 0" + changed_when: "restorecon_result.rc == 0" - name: Add firewall rules - http/s ansible.posix.firewalld: diff --git a/ansible/playbooks/templates/etc/gitlab/rocky_gitlab.rb b/ansible/playbooks/templates/etc/gitlab/rocky_gitlab.rb index 6795d13..a0a888f 100644 --- a/ansible/playbooks/templates/etc/gitlab/rocky_gitlab.rb +++ b/ansible/playbooks/templates/etc/gitlab/rocky_gitlab.rb @@ -122,3 +122,13 @@ registry_nginx['ssl_certificate_key'] = "{{ gitlab_registry_nginx_ssl_certificat # https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#changing-gitlab-yml-settings nginx['enable'] = false nginx['external_users'] = ['nginx'] + +{% if gitlab_external_db %} +postgresql['enable'] = false +gitlab_rails['db_adapter'] = 'postgresql' +gitlab_rails['db_encoding'] = 'unicode' +gitlab_rails['db_host'] = '{{ gitlab_external_db_host }}' +gitlab_rails['db_port'] = '{{ gitlab_external_db_port }}' +gitlab_rails['db_username'] = '{{ gitlab_external_db_user }}' +gitlab_rails['db_password'] = '{{ gitlab_external_db_password }}' +{% endif %} diff --git a/ansible/playbooks/vars/gitlab.yml b/ansible/playbooks/vars/gitlab.yml index bfa66de..0b39ec1 100644 --- a/ansible/playbooks/vars/gitlab.yml +++ b/ansible/playbooks/vars/gitlab.yml @@ -61,3 +61,8 @@ gitlab_nginx_listen_port: 8080 gitlab_nginx_listen_https: "false" gitlab_default_theme: 2 + +gitlab_external_db: false +gitlab_external_db_host: db.rockylinux.org +gitlab_external_db_user: gitlab +gitlab_external_db_password: gitlab