diff --git a/ansible/roles/haproxy/templates/haproxy.cfg.j2 b/ansible/roles/haproxy/templates/haproxy.cfg.j2 index 959e0da358..f95eeddf06 100644 --- a/ansible/roles/haproxy/templates/haproxy.cfg.j2 +++ b/ansible/roles/haproxy/templates/haproxy.cfg.j2 @@ -552,6 +552,22 @@ listen congress_api_external {% endif %} {% endif %} +{% if enable_mistral | bool %} +listen mistral_api + bind {{ kolla_internal_vip_address }}:{{ mistral_api_port }} +{% for host in groups['mistral-api'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ mistral_api_port }} check inter 2000 rise 2 fall 5 +{% endfor %} +{% if haproxy_enable_external_vip | bool %} + +listen mistral_api_external + bind {{ kolla_external_vip_address }}:{{ mistral_api_port }} {{ tls_bind_info }} +{% for host in groups['mistral-api'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ mistral_api_port }} check inter 2000 rise 2 fall 5 +{% endfor %} +{% endif %} +{% endif %} + # (NOTE): This defaults section deletes forwardfor as recomended by: # https://marc.info/?l=haproxy&m=141684110710132&w=1 diff --git a/ansible/roles/mistral/defaults/main.yml b/ansible/roles/mistral/defaults/main.yml index b1e4eb1809..cca068623d 100644 --- a/ansible/roles/mistral/defaults/main.yml +++ b/ansible/roles/mistral/defaults/main.yml @@ -28,9 +28,9 @@ mistral_api_image_full: "{{ mistral_api_image }}:{{ mistral_api_tag }}" #################### # OpenStack #################### -mistral_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ mistral_api_port }}" -mistral_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ mistral_api_port }}" -mistral_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ mistral_api_port }}" +mistral_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ mistral_api_port }}/v2" +mistral_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ mistral_api_port }}/v2" +mistral_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ mistral_api_port }}/v2" mistral_logging_debug: "{{ openstack_logging_debug }}" diff --git a/ansible/roles/mistral/templates/mistral.conf.j2 b/ansible/roles/mistral/templates/mistral.conf.j2 index 7cdbcd35a3..27639dfca0 100644 --- a/ansible/roles/mistral/templates/mistral.conf.j2 +++ b/ansible/roles/mistral/templates/mistral.conf.j2 @@ -7,13 +7,14 @@ log_dir = /var/log/kolla/mistral # stderr and collected by Docker use_stderr = False -{% if service_name == 'mistral-api' %} -bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} -bind_port = {{ mistral_api_port }} -{% endif %} - transport_url = rabbit://{% for host in groups['rabbitmq'] %}{{ rabbitmq_user }}:{{ rabbitmq_password }}@{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ rabbitmq_port }}{% if not loop.last %},{% endif %}{% endfor %} +{% if service_name == 'mistral-api' %} +[api] +host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} +port = {{ mistral_api_port }} +{% endif %} + [database] connection = mysql+pymysql://{{ mistral_database_user }}:{{ mistral_database_password }}@{{ mistral_database_address }}/{{ mistral_database_name }} max_retries = -1 diff --git a/ansible/roles/prechecks/tasks/port_checks.yml b/ansible/roles/prechecks/tasks/port_checks.yml index 6c741cd8ac..c0f2bd88f6 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -553,6 +553,22 @@ state: stopped when: inventory_hostname in groups['haproxy'] +- name: Checking free port for Mistral API + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ mistral_api_port }}" + connect_timeout: 1 + state: stopped + when: inventory_hostname in groups['mistral-api'] + +- name: Checking free port for Mistral API HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ mistral_api_port }}" + connect_timeout: 1 + state: stopped + when: inventory_hostname in groups['haproxy'] + - name: Checking if kolla_internal_vip_address and kolla_external_vip_address are not pingable from any node command: ping -c 3 {{ item }} register: ping_output diff --git a/docker/mistral/mistral-api/extend_start.sh b/docker/mistral/mistral-api/extend_start.sh index 4316395acb..113adb8a21 100644 --- a/docker/mistral/mistral-api/extend_start.sh +++ b/docker/mistral/mistral-api/extend_start.sh @@ -4,5 +4,6 @@ # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head + mistral-db-manage --config-file /etc/mistral/mistral.conf populate exit 0 fi