From f8a1a716ac4dea433f13a82d8bf6702afbe2bb51 Mon Sep 17 00:00:00 2001 From: Jim Rollenhagen Date: Thu, 27 Dec 2018 15:45:03 -0500 Subject: [PATCH] Allow gnocchi services to use independent hostnames This allows gnocchi service endpoints to use custom hostnames, and adds the following variables: * gnocchi_internal_fqdn * gnocchi_external_fqdn These default to the old values of kolla_internal_fqdn or kolla_external_fqdn. This also adds a gnocchi_api_listen_port option, which defaults to gnocchi_api_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: Ic9a0f8130b19ed77987f45fd0e824b82ea7a7328 Implements: blueprint service-hostnames --- ansible/group_vars/all.yml | 3 +++ ansible/roles/gnocchi/defaults/main.yml | 10 +++++----- ansible/roles/gnocchi/tasks/precheck.yml | 2 +- ansible/roles/gnocchi/templates/gnocchi.conf.j2 | 2 +- ansible/roles/gnocchi/templates/wsgi-gnocchi.conf.j2 | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index ed80001a05..6f85ab5a35 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -229,7 +229,10 @@ glance_external_fqdn: "{{ kolla_external_fqdn }}" glance_api_port: "9292" glance_api_listen_port: "{{ glance_api_port }}" +gnocchi_internal_fqdn: "{{ kolla_internal_fqdn }}" +gnocchi_external_fqdn: "{{ kolla_external_fqdn }}" gnocchi_api_port: "8041" +gnocchi_api_listen_port: "{{ gnocchi_api_port }}" grafana_server_port: "3000" diff --git a/ansible/roles/gnocchi/defaults/main.yml b/ansible/roles/gnocchi/defaults/main.yml index 79e4530912..ba4124e527 100644 --- a/ansible/roles/gnocchi/defaults/main.yml +++ b/ansible/roles/gnocchi/defaults/main.yml @@ -18,12 +18,12 @@ gnocchi_services: enabled: "{{ enable_gnocchi }}" mode: "http" external: false - port: "{{ gnocchi_api_port }}" + port: "{{ gnocchi_api_listen_port }}" gnocchi_api_external: enabled: "{{ enable_gnocchi }}" mode: "http" external: true - port: "{{ gnocchi_api_port }}" + port: "{{ gnocchi_api_listen_port }}" gnocchi-metricd: container_name: gnocchi_metricd group: gnocchi-metricd @@ -110,9 +110,9 @@ gnocchi_statsd_dimensions: "{{ default_container_dimensions }}" #################### # OpenStack #################### -gnocchi_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ gnocchi_api_port }}" -gnocchi_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ gnocchi_api_port }}" -gnocchi_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ gnocchi_api_port }}" +gnocchi_admin_endpoint: "{{ admin_protocol }}://{{ gnocchi_internal_fqdn }}:{{ gnocchi_api_port }}" +gnocchi_internal_endpoint: "{{ internal_protocol }}://{{ gnocchi_internal_fqdn }}:{{ gnocchi_api_port }}" +gnocchi_public_endpoint: "{{ public_protocol }}://{{ gnocchi_external_fqdn }}:{{ gnocchi_api_port }}" gnocchi_logging_debug: "{{ openstack_logging_debug }}" diff --git a/ansible/roles/gnocchi/tasks/precheck.yml b/ansible/roles/gnocchi/tasks/precheck.yml index 001953e431..a352d9701d 100644 --- a/ansible/roles/gnocchi/tasks/precheck.yml +++ b/ansible/roles/gnocchi/tasks/precheck.yml @@ -8,7 +8,7 @@ - name: Checking free port for Gnocchi API wait_for: host: "{{ api_interface_address }}" - port: "{{ gnocchi_api_port }}" + port: "{{ gnocchi_api_listen_port }}" connect_timeout: 1 timeout: 1 state: stopped diff --git a/ansible/roles/gnocchi/templates/gnocchi.conf.j2 b/ansible/roles/gnocchi/templates/gnocchi.conf.j2 index 11a50dee5e..9308e74c6c 100644 --- a/ansible/roles/gnocchi/templates/gnocchi.conf.j2 +++ b/ansible/roles/gnocchi/templates/gnocchi.conf.j2 @@ -13,7 +13,7 @@ log_file = /var/log/kolla/gnocchi/gnocchi-api.log {% endif %} [api] -port = {{ gnocchi_api_port }} +port = {{ gnocchi_api_listen_port }} host = {{ api_interface_address }} middlewares = keystonemiddleware.auth_token.AuthProtocol auth_mode = keystone diff --git a/ansible/roles/gnocchi/templates/wsgi-gnocchi.conf.j2 b/ansible/roles/gnocchi/templates/wsgi-gnocchi.conf.j2 index 399afa948b..3a289ed323 100644 --- a/ansible/roles/gnocchi/templates/wsgi-gnocchi.conf.j2 +++ b/ansible/roles/gnocchi/templates/wsgi-gnocchi.conf.j2 @@ -1,12 +1,12 @@ {% set python_path = '/usr/lib/python2.7/site-packages' if gnocchi_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %} {% set wsgi_path = '/usr/bin' if gnocchi_install_type == 'binary' else '/var/lib/kolla/venv/bin' %} -Listen {{ api_interface_address }}:{{ gnocchi_api_port }} +Listen {{ api_interface_address }}:{{ gnocchi_api_listen_port }} ServerSignature Off ServerTokens Prod TraceEnable off - + ErrorLog "/var/log/kolla/gnocchi/gnocchi-api-error.log" LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat