diff --git a/defaults/main.yml b/defaults/main.yml index 0f4c87c0..32f1bb25 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -109,7 +109,13 @@ octavia_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers | default('127.0.0.1') }}" octavia_oslomsg_rpc_port: "{{ oslomsg_rpc_port | default('5672') }}" octavia_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}" octavia_oslomsg_rpc_userid: octavia -octavia_oslomsg_rpc_vhost: /octavia +# vhost name depends on value of oslomsg_rabbit_quorum_queues. In case quorum queues +# are not used - vhost name will be prefixed with leading `/`. +octavia_oslomsg_rpc_vhost: + - name: /octavia + state: "{{ octavia_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}" + - name: octavia + state: "{{ octavia_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}" octavia_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') }}" octavia_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}" @@ -127,6 +133,11 @@ octavia_oslomsg_notify_vhost: "{{ octavia_oslomsg_rpc_vhost }}" octavia_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_2') }}" octavia_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}" +## RabbitMQ integration +octavia_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}" +octavia_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}" +octavia_oslomsg_rabbit_quorum_max_memory_bytes: "{{ oslomsg_rabbit_quorum_max_memory_bytes | default(0) }}" + ## (Qdrouterd) integration # TODO(ansmith): Change structure when more backends will be supported octavia_oslomsg_amqp1_enabled: "{{ octavia_oslomsg_rpc_transport == 'amqp' }}" diff --git a/templates/octavia.conf.j2 b/templates/octavia.conf.j2 index 5ed0077e..79dddcdf 100644 --- a/templates/octavia.conf.j2 +++ b/templates/octavia.conf.j2 @@ -3,7 +3,7 @@ debug = {{ debug }} use_journal = True executor_thread_pool_size = {{ octavia_rpc_thread_pool_size }} rpc_conn_pool_size = {{ octavia_rpc_conn_pool_size }} -transport_url = {{ octavia_oslomsg_rpc_transport }}://{% for host in octavia_oslomsg_rpc_servers.split(',') %}{{ octavia_oslomsg_rpc_userid }}:{{ octavia_oslomsg_rpc_password }}@{{ host }}:{{ octavia_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ octavia_oslomsg_rpc_vhost }}{% if octavia_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ octavia_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ octavia_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} +transport_url = {{ octavia_oslomsg_rpc_transport }}://{% for host in octavia_oslomsg_rpc_servers.split(',') %}{{ octavia_oslomsg_rpc_userid }}:{{ octavia_oslomsg_rpc_password }}@{{ host }}:{{ octavia_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _octavia_oslomsg_rpc_vhost_conf }}{% if octavia_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ octavia_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ octavia_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} [api_settings] bind_host = {{ octavia_uwsgi_bind_address }} @@ -23,10 +23,13 @@ topic = octavia_prov [oslo_messaging_rabbit] ssl = {{ octavia_oslomsg_rpc_use_ssl }} +rabbit_quorum_queue = {{ octavia_oslomsg_rabbit_quorum_queues }} +rabbit_quorum_delivery_limit = {{ octavia_oslomsg_rabbit_quorum_delivery_limit }} +rabbit_quorum_max_memory_bytes = {{ octavia_oslomsg_rabbit_quorum_max_memory_bytes }} [oslo_messaging_notifications] driver = {{ (octavia_ceilometer_enabled | bool) | ternary('messagingv2', 'noop') }} -transport_url = {{ octavia_oslomsg_notify_transport }}://{% for host in octavia_oslomsg_notify_servers.split(',') %}{{ octavia_oslomsg_notify_userid }}:{{ octavia_oslomsg_notify_password }}@{{ host }}:{{ octavia_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ octavia_oslomsg_notify_vhost }}{% if octavia_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ octavia_oslomsg_notify_ssl_version }}&ssl_ca_file={{ octavia_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} +transport_url = {{ octavia_oslomsg_notify_transport }}://{% for host in octavia_oslomsg_notify_servers.split(',') %}{{ octavia_oslomsg_notify_userid }}:{{ octavia_oslomsg_notify_password }}@{{ host }}:{{ octavia_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _octavia_oslomsg_notify_vhost_conf }}{% if octavia_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ octavia_oslomsg_notify_ssl_version }}&ssl_ca_file={{ octavia_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} [database] connection = mysql+pymysql://{{ octavia_galera_user }}:{{ octavia_container_mysql_password }}@{{ octavia_galera_address }}:{{ octavia_galera_port }}/{{ octavia_galera_database }}?charset=utf8{% if octavia_galera_use_ssl | bool %}&ssl_verify_cert=true{% if octavia_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ octavia_galera_ssl_ca_cert }}{% endif %}{% endif +%} diff --git a/vars/main.yml b/vars/main.yml index d9b10d42..0e5f13c9 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -19,6 +19,18 @@ _octavia_is_first_play_host: >- inventory_hostname == (groups[octavia_services['octavia-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }} +_octavia_oslomsg_rpc_vhost_conf: >- + {{ + (octavia_oslomsg_rpc_vhost is string) | ternary( + octavia_oslomsg_rpc_vhost, octavia_oslomsg_rpc_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first) + }} + +_octavia_oslomsg_notify_vhost_conf: >- + {{ + (octavia_oslomsg_notify_vhost is string) | ternary( + octavia_oslomsg_notify_vhost, octavia_oslomsg_notify_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first) + }} + # # Compile a list of the services on a host based on whether # the host is in the host group and the service is enabled.