diff --git a/roles/gitlab/defaults/main.yaml b/roles/gitlab/defaults/main.yaml index a8473f9..78455cb 100644 --- a/roles/gitlab/defaults/main.yaml +++ b/roles/gitlab/defaults/main.yaml @@ -1,5 +1,6 @@ --- host_fqdn: '{{ ansible_hostname }}.dmz.{{ domain }}' +monitoring_vhosts: [] gitlab_nginx_main_fqdn: '{{ ansible_hostname }}.{{ domain }}' gitlab_nginx_mattermost_fqdn: 'mattermost.{{ domain }}' gitlab_ssh_port: 8022 diff --git a/roles/gitlab/tasks/main.yaml b/roles/gitlab/tasks/main.yaml index 2c83440..9c0d656 100644 --- a/roles/gitlab/tasks/main.yaml +++ b/roles/gitlab/tasks/main.yaml @@ -91,34 +91,35 @@ block: - name: 'MONITORING | add HTTP/gitlab to monitored service' set_fact: - vhosts: > - {{ hostvars[monitoring_host]['monitoring_facts'][host_fqdn]['vhosts'] - | default([]) }} + monitoring_vhosts: '{{ monitoring_vhosts + [gitlab_nginx_main_fqdn] }}' + when: gitlab_enable_https - name: 'MONITORING | add HTTP/mattermost to monitored service' set_fact: - vhosts: '{{ vhosts + [gitlab_fqdn] }}' - when: enable_https - - name: 'MONITORING | update host monitoring entry' + monitoring_vhosts: '{{ monitoring_vhosts + [gitlab_nginx_mattermost_fqdn] }}' + when: gitlab_enable_mattermost + - name: 'MONITORING | add vhosts to host monitoring entry' set_fact: - vhosts: '{{ vhosts + [mattermost_fqdn] }}' - when: enable_mattermost - - name: 'MONITORING | create host monitoring entry' + monitoring_entry: > + {{ monitoring_entry | default({}) | combine({ + 'address': ansible_host, + 'vhosts': monitoring_vhosts, + }) }} + - name: 'MONITORING | add vhosts_uri to host monitoring entry' set_fact: - gitlab_monitoring_entry: > - {{ { - host_fqdn: { - 'address': ansible_host, - 'vhosts': vhosts, - } - } }} + monitoring_entry: > + {{ monitoring_entry | default({}) | combine({ + 'address': ansible_host, + 'vhosts_uri': { gitlab_nginx_main_fqdn: {'/': 'Sign in ยท GitLab'}, + gitlab_nginx_mattermost_fqdn: { '/': '