diff --git a/defaults/main.yml b/defaults/main.yml index c345f45..43bab9d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -82,7 +82,13 @@ senlin_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers | default('127.0.0.1') }}" senlin_oslomsg_rpc_port: "{{ oslomsg_rpc_port | default('5672') }}" senlin_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}" senlin_oslomsg_rpc_userid: senlin -senlin_oslomsg_rpc_vhost: /senlin +# vhost name depends on value of oslomsg_rabbit_quorum_queues. In case quorum queues +# are not used - vhost name will be prefixed with leading `/`. +senlin_oslomsg_rpc_vhost: + - name: /senlin + state: "{{ senlin_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}" + - name: senlin + state: "{{ senlin_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}" senlin_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') }}" senlin_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}" @@ -99,6 +105,11 @@ senlin_oslomsg_notify_vhost: "{{ senlin_oslomsg_rpc_vhost }}" senlin_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_2') }}" senlin_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}" +## RabbitMQ integration +senlin_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}" +senlin_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}" +senlin_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 senlin_oslomsg_amqp1_enabled: "{{ senlin_oslomsg_rpc_transport == 'amqp' }}" diff --git a/templates/senlin.conf.j2 b/templates/senlin.conf.j2 index 4df9a46..9388e4a 100644 --- a/templates/senlin.conf.j2 +++ b/templates/senlin.conf.j2 @@ -11,7 +11,7 @@ use_journal = True server_keystone_endpoint_type = public ## RPC Backend -transport_url = {{ senlin_oslomsg_rpc_transport }}://{% for host in senlin_oslomsg_rpc_servers.split(',') %}{{ senlin_oslomsg_rpc_userid }}:{{ senlin_oslomsg_rpc_password }}@{{ host }}:{{ senlin_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ senlin_oslomsg_rpc_vhost }}{% if senlin_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ senlin_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ senlin_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} +transport_url = {{ senlin_oslomsg_rpc_transport }}://{% for host in senlin_oslomsg_rpc_servers.split(',') %}{{ senlin_oslomsg_rpc_userid }}:{{ senlin_oslomsg_rpc_password }}@{{ host }}:{{ senlin_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _senlin_oslomsg_rpc_vhost_conf }}{% if senlin_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ senlin_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ senlin_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} # Default region name used to get services endpoints. region_name_for_services = {{ senlin_service_region }} @@ -49,6 +49,9 @@ workers = {{ senlin_api_workers | default(senlin_api_threads) }} [oslo_messaging_rabbit] ssl = {{ senlin_oslomsg_rpc_use_ssl }} +rabbit_quorum_queue = {{ senlin_oslomsg_rabbit_quorum_queues }} +rabbit_quorum_delivery_limit = {{ senlin_oslomsg_rabbit_quorum_delivery_limit }} +rabbit_quorum_max_memory_bytes = {{ senlin_oslomsg_rabbit_quorum_max_memory_bytes }} {% if senlin_service_publicuri_proto != senlin_service_internaluri_proto %} [oslo_middleware] @@ -58,7 +61,7 @@ enable_proxy_headers_parsing = True # Ceilometer options [oslo_messaging_notifications] driver = {{ (senlin_ceilometer_enabled | bool) | ternary('messagingv2', 'noop') }} -transport_url = {{ senlin_oslomsg_notify_transport }}://{% for host in senlin_oslomsg_notify_servers.split(',') %}{{ senlin_oslomsg_notify_userid }}:{{ senlin_oslomsg_notify_password }}@{{ host }}:{{ senlin_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ senlin_oslomsg_notify_vhost }}{% if senlin_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ senlin_oslomsg_notify_ssl_version }}&ssl_ca_file={{ senlin_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} +transport_url = {{ senlin_oslomsg_notify_transport }}://{% for host in senlin_oslomsg_notify_servers.split(',') %}{{ senlin_oslomsg_notify_userid }}:{{ senlin_oslomsg_notify_password }}@{{ host }}:{{ senlin_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _senlin_oslomsg_notify_vhost_conf }}{% if senlin_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ senlin_oslomsg_notify_ssl_version }}&ssl_ca_file={{ senlin_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} [profiler] diff --git a/vars/main.yml b/vars/main.yml index 42d8f88..9fb0d6e 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -18,6 +18,16 @@ _senlin_is_first_play_host: >- (senlin_services['senlin-api']['group'] in group_names and inventory_hostname == (groups[senlin_services['senlin-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }} +_senlin_oslomsg_rpc_vhost_conf: >- + {{ + (senlin_oslomsg_rpc_vhost is string) | ternary( + senlin_oslomsg_rpc_vhost, senlin_oslomsg_rpc_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first) + }} +_senlin_oslomsg_notify_vhost_conf: >- + {{ + (senlin_oslomsg_notify_vhost is string) | ternary( + senlin_oslomsg_notify_vhost, senlin_oslomsg_notify_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first) + }} # # Compile a list of the services on a host based on whether