From 3ee1a7ce3c52015cc73b002595ca0ec7262ea401 Mon Sep 17 00:00:00 2001 From: Jim Rollenhagen Date: Thu, 27 Dec 2018 15:55:55 -0500 Subject: [PATCH] Allow horizon listening port to be different than reachable port This adds a horizon_listen_port option, which defaults to horizon_port for backward compatibility. This option allow the user to differentiate between the port the service listens on, and the port the service is reachable on. This is useful for external load balancers which live on the same host as the service itself. Change-Id: I1e47e9524fd9c41bbb2cd2fc80560e53d9296599 Implements: blueprint service-hostnames --- ansible/group_vars/all.yml | 1 + ansible/roles/horizon/defaults/main.yml | 3 +++ ansible/roles/horizon/tasks/precheck.yml | 2 +- ansible/roles/horizon/templates/horizon.conf.j2 | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 6f85ab5a35..7b124a214f 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -249,6 +249,7 @@ heat_api_cfn_port: "8000" heat_api_cfn_listen_port: "{{ heat_api_cfn_port }}" horizon_port: "80" +horizon_listen_port: "{{ horizon_port }}" influxdb_admin_port: "8083" influxdb_http_port: "8086" diff --git a/ansible/roles/horizon/defaults/main.yml b/ansible/roles/horizon/defaults/main.yml index b8f7b1d146..4577eb8e99 100644 --- a/ansible/roles/horizon/defaults/main.yml +++ b/ansible/roles/horizon/defaults/main.yml @@ -49,6 +49,7 @@ horizon_services: mode: "http" external: false port: "{{ horizon_port }}" + listen_port: "{{ horizon_listen_port }}" frontend_http_extra: - "balance source" horizon_external: @@ -56,6 +57,7 @@ horizon_services: mode: "http" external: true port: "{% if kolla_enable_tls_external|bool %}443{% else %}{{ horizon_port }}{% endif %}" + listen_port: "{{ horizon_listen_port }}" frontend_http_extra: - "balance source" horizon_external_redirect: @@ -63,6 +65,7 @@ horizon_services: mode: "redirect" external: true port: "{{ horizon_port }}" + listen_port: "{{ horizon_listen_port }}" horizon_keystone_domain_choices: Default: default diff --git a/ansible/roles/horizon/tasks/precheck.yml b/ansible/roles/horizon/tasks/precheck.yml index 43855f8886..740e61602f 100644 --- a/ansible/roles/horizon/tasks/precheck.yml +++ b/ansible/roles/horizon/tasks/precheck.yml @@ -10,7 +10,7 @@ horizon: "{{ horizon_services['horizon'] }}" wait_for: host: "{{ api_interface_address }}" - port: "{{ horizon_port }}" + port: "{{ horizon_listen_port }}" connect_timeout: 1 timeout: 1 state: stopped diff --git a/ansible/roles/horizon/templates/horizon.conf.j2 b/ansible/roles/horizon/templates/horizon.conf.j2 index aa14da3862..5b442f843b 100644 --- a/ansible/roles/horizon/templates/horizon.conf.j2 +++ b/ansible/roles/horizon/templates/horizon.conf.j2 @@ -1,11 +1,11 @@ {% set python_path = '/usr/share/openstack-dashboard' if horizon_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %} -Listen {{ api_interface_address }}:{{ horizon_port }} +Listen {{ api_interface_address }}:{{ horizon_listen_port }} ServerSignature Off ServerTokens Prod TraceEnable off - + LogLevel warn ErrorLog /var/log/kolla/horizon/horizon.log LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat