From a819ef1215530c741e1baa800e746bde43878380 Mon Sep 17 00:00:00 2001 From: Jim Rollenhagen <jim@jimrollenhagen.com> Date: Tue, 18 Dec 2018 10:39:22 -0500 Subject: [PATCH] Allow glance services to use independent hostnames This allows glance service endpoints to use custom hostnames, and adds the following variables: * glance_internal_fqdn * glance_external_fqdn These default to the old values of kolla_internal_fqdn or kolla_external_fqdn. This also adds a glance_api_listen_port option, which defaults to glance_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: Icb91f728533e2db1908b23dabb0501cf9f8a2b75 Implements: blueprint service-hostnames --- ansible/group_vars/all.yml | 3 +++ ansible/roles/cinder/templates/cinder.conf.j2 | 2 +- ansible/roles/glance/defaults/main.yml | 9 +++++---- ansible/roles/glance/tasks/precheck.yml | 2 +- ansible/roles/glance/templates/glance-api.conf.j2 | 4 ++-- ansible/roles/ironic/templates/ironic.conf.j2 | 2 +- ansible/roles/nova-hyperv/templates/nova_hyperv.conf.j2 | 2 +- ansible/roles/nova/templates/nova.conf.j2 | 2 +- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index b53e135f18..aecfbfcf85 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -211,7 +211,10 @@ fluentd_syslog_port: "5140" freezer_api_port: "9090" +glance_internal_fqdn: "{{ kolla_internal_fqdn }}" +glance_external_fqdn: "{{ kolla_external_fqdn }}" glance_api_port: "9292" +glance_api_listen_port: "{{ glance_api_port }}" gnocchi_api_port: "8041" diff --git a/ansible/roles/cinder/templates/cinder.conf.j2 b/ansible/roles/cinder/templates/cinder.conf.j2 index 11a5dbf3e2..5a5b0f65a6 100644 --- a/ansible/roles/cinder/templates/cinder.conf.j2 +++ b/ansible/roles/cinder/templates/cinder.conf.j2 @@ -13,7 +13,7 @@ my_ip = {{ api_interface_address }} osapi_volume_workers = {{ openstack_service_workers }} volume_name_template = volume-%s -glance_api_servers = {{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ glance_api_port }} +glance_api_servers = {{ internal_protocol }}://{{ glance_internal_fqdn }}:{{ glance_api_port }} glance_num_retries = {{ groups['glance-api'] | length }} glance_api_version = 2 diff --git a/ansible/roles/glance/defaults/main.yml b/ansible/roles/glance/defaults/main.yml index 7f1f9672fb..f417edaed7 100644 --- a/ansible/roles/glance/defaults/main.yml +++ b/ansible/roles/glance/defaults/main.yml @@ -41,7 +41,7 @@ glance_services: #################### # HAProxy #################### -haproxy_members: "{% for host in glance_api_hosts %}server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ glance_api_port }} check inter 2000 rise 2 fall 5;{% endfor %}" +haproxy_members: "{% for host in glance_api_hosts %}server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ glance_api_listen_port }} check inter 2000 rise 2 fall 5;{% endfor %}" #################### # Notification @@ -125,9 +125,10 @@ glance_store_backends: "{{ glance_backends|selectattr('enabled', 'equalto', true #################### # OpenStack #################### -glance_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ glance_api_port }}" -glance_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ glance_api_port }}" -glance_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ glance_api_port }}" + +glance_admin_endpoint: "{{ admin_protocol }}://{{ glance_internal_fqdn }}:{{ glance_api_port }}" +glance_internal_endpoint: "{{ internal_protocol }}://{{ glance_internal_fqdn }}:{{ glance_api_port }}" +glance_public_endpoint: "{{ public_protocol }}://{{ glance_external_fqdn }}:{{ glance_api_port }}" glance_logging_debug: "{{ openstack_logging_debug }}" diff --git a/ansible/roles/glance/tasks/precheck.yml b/ansible/roles/glance/tasks/precheck.yml index 6c0386602b..a443a53571 100644 --- a/ansible/roles/glance/tasks/precheck.yml +++ b/ansible/roles/glance/tasks/precheck.yml @@ -7,7 +7,7 @@ - name: Checking free port for Glance API wait_for: host: "{{ api_interface_address }}" - port: "{{ glance_api_port }}" + port: "{{ glance_api_listen_port }}" connect_timeout: 1 timeout: 1 state: stopped diff --git a/ansible/roles/glance/templates/glance-api.conf.j2 b/ansible/roles/glance/templates/glance-api.conf.j2 index 859ac79dfc..c737d1aca4 100644 --- a/ansible/roles/glance/templates/glance-api.conf.j2 +++ b/ansible/roles/glance/templates/glance-api.conf.j2 @@ -6,10 +6,10 @@ log_file = /var/log/kolla/glance/glance-api.log use_forwarded_for = true bind_host = {{ api_interface_address }} -bind_port = {{ glance_api_port }} +bind_port = {{ glance_api_listen_port }} workers = {{ openstack_service_workers }} -registry_host = {{ kolla_internal_fqdn }} +registry_host = {{ glance_internal_fqdn }} {% if glance_backend_ceph | bool %} show_multiple_locations = True diff --git a/ansible/roles/ironic/templates/ironic.conf.j2 b/ansible/roles/ironic/templates/ironic.conf.j2 index c21b8b1e21..81c373e17b 100644 --- a/ansible/roles/ironic/templates/ironic.conf.j2 +++ b/ansible/roles/ironic/templates/ironic.conf.j2 @@ -72,7 +72,7 @@ password = {{ ironic_keystone_password }} {% endif %} [glance] -glance_api_servers = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ glance_api_port }} +glance_api_servers = {{ internal_protocol }}://{{ glance_internal_fqdn }}:{{ glance_api_port }} auth_url = {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }} auth_type = password project_domain_id = default diff --git a/ansible/roles/nova-hyperv/templates/nova_hyperv.conf.j2 b/ansible/roles/nova-hyperv/templates/nova_hyperv.conf.j2 index 8bd7368fa9..7cd9515d76 100644 --- a/ansible/roles/nova-hyperv/templates/nova_hyperv.conf.j2 +++ b/ansible/roles/nova-hyperv/templates/nova_hyperv.conf.j2 @@ -31,7 +31,7 @@ user_domain_name = {{ default_user_domain_name }} os_region_name = {{ openstack_region_name }} [glance] -api_servers = {{ internal_protocol }}://{% for host in groups['glance-api'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ glance_api_port }}{% if not loop.last %},{% endif %}{% endfor %} +api_servers = {{ internal_protocol }}://{{ glance_internal_fqdn }}:{{ glance_api_port }} [hyperv] diff --git a/ansible/roles/nova/templates/nova.conf.j2 b/ansible/roles/nova/templates/nova.conf.j2 index 540f25f723..45e5bc7728 100644 --- a/ansible/roles/nova/templates/nova.conf.j2 +++ b/ansible/roles/nova/templates/nova.conf.j2 @@ -128,7 +128,7 @@ enable_proxy_headers_parsing = True lock_path = /var/lib/nova/tmp [glance] -api_servers = {{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ glance_api_port }} +api_servers = {{ internal_protocol }}://{{ glance_internal_fqdn }}:{{ glance_api_port }} num_retries = {{ groups['glance-api'] | length }}