From c1d80d3410a5f719f6b56f827158d96e2c9b793b Mon Sep 17 00:00:00 2001 From: prameswar Date: Tue, 25 Oct 2016 22:50:09 +0530 Subject: grafana added to haproxy to listen on VIP Closes-bug: #1636579 Change-Id: I5628196885bddebab84abb71c89753582123418c --- ansible/group_vars/all.yml | 2 ++ ansible/roles/grafana/templates/grafana.ini.j2 | 2 +- ansible/roles/haproxy/templates/haproxy.cfg.j2 | 20 ++++++++++++++++++++ ansible/roles/prechecks/tasks/port_checks.yml | 20 ++++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 309dd48b7..7834e5ddf 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -202,6 +202,8 @@ kuryr_port: "23750" searchlight_api_port: "9393" +grafana_server_port: "3000" + public_protocol: "{{ 'https' if kolla_enable_tls_external | bool else 'http' }}" internal_protocol: "http" admin_protocol: "http" diff --git a/ansible/roles/grafana/templates/grafana.ini.j2 b/ansible/roles/grafana/templates/grafana.ini.j2 index b7f10f638..6128a48d1 100644 --- a/ansible/roles/grafana/templates/grafana.ini.j2 +++ b/ansible/roles/grafana/templates/grafana.ini.j2 @@ -6,7 +6,7 @@ plugins = /var/lib/grafana/plugins [server] protocol = http http_addr = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} -http_port = 3000 +http_port = {{ grafana_server_port }} router_logging = true diff --git a/ansible/roles/haproxy/templates/haproxy.cfg.j2 b/ansible/roles/haproxy/templates/haproxy.cfg.j2 index cc7d6fc3e..466e85877 100644 --- a/ansible/roles/haproxy/templates/haproxy.cfg.j2 +++ b/ansible/roles/haproxy/templates/haproxy.cfg.j2 @@ -289,6 +289,26 @@ listen heat_api_cfn_external {% endif %} {% endif %} +{% if enable_grafana | bool %} +listen grafana_server + bind {{ kolla_internal_vip_address }}:{{ grafana_server_port }} + http-request del-header X-Forwarded-Proto + http-request set-header X-Forwarded-Proto https if { ssl_fc } +{% for host in groups['grafana'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ grafana_server_port }} check inter 2000 rise 2 fall 5 +{% endfor %} +{% if haproxy_enable_external_vip | bool %} + +listen grafana_server_external + bind {{ kolla_external_vip_address }}:{{ grafana_server_port }} {{ tls_bind_info }} + http-request del-header X-Forwarded-Proto + http-request set-header X-Forwarded-Proto https if { ssl_fc } +{% for host in groups['grafana'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ grafana_server_port }} check inter 2000 rise 2 fall 5 +{% endfor %} +{% endif %} +{% endif %} + {% if enable_ironic | bool %} listen ironic_api bind {{ kolla_internal_vip_address }}:{{ ironic_api_port }} diff --git a/ansible/roles/prechecks/tasks/port_checks.yml b/ansible/roles/prechecks/tasks/port_checks.yml index 42a3f5900..3ac303df6 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -778,6 +778,26 @@ - inventory_hostname in groups['haproxy'] - enable_ceph_rgw | bool +- name: Checking free port for Grafana server + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ grafana_server_port }}" + connect_timeout: 1 + state: stopped + when: + - inventory_hostname in groups['grafana'] + - enable_grafana | bool + +- name: Checking free port for Grafana server HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ grafana_server_port }}" + connect_timeout: 1 + state: stopped + when: + - inventory_hostname in groups['haproxy'] + - enable_grafana | bool + - name: Checking free port for Senlin API wait_for: host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" -- cgit v1.2.3