diff --git a/defaults/main.yml b/defaults/main.yml index dbc5c8e4..472c683b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -106,7 +106,13 @@ glance_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers | default('127.0.0.1') }}" glance_oslomsg_rpc_port: "{{ oslomsg_rpc_port | default('5672') }}" glance_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}" glance_oslomsg_rpc_userid: glance -glance_oslomsg_rpc_vhost: /glance +# vhost name depends on value of oslomsg_rabbit_quorum_queues. In case quorum queues +# are not used - vhost name will be prefixed with leading `/`. +glance_oslomsg_rpc_vhost: + - name: /glance + state: "{{ glance_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}" + - name: glance + state: "{{ glance_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}" glance_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') }}" glance_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}" @@ -123,6 +129,11 @@ glance_oslomsg_notify_vhost: "{{ glance_oslomsg_rpc_vhost }}" glance_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_2') }}" glance_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}" +## RabbitMQ integration +glance_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}" +glance_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}" +glance_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 glance_oslomsg_amqp1_enabled: "{{ glance_oslomsg_rpc_transport == 'amqp' }}" diff --git a/templates/glance-api.conf.j2 b/templates/glance-api.conf.j2 index 514086ce..c91edf3f 100644 --- a/templates/glance-api.conf.j2 +++ b/templates/glance-api.conf.j2 @@ -16,7 +16,7 @@ cinder_catalog_info = volumev3:cinderv3:internalURL enable_v2_api = {{ glance_enable_v2_api | bool }} -transport_url = {{ glance_oslomsg_rpc_transport }}://{% for host in glance_oslomsg_rpc_servers.split(',') %}{{ glance_oslomsg_rpc_userid }}:{{ glance_oslomsg_rpc_password }}@{{ host }}:{{ glance_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ glance_oslomsg_rpc_vhost }}{% if glance_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ glance_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ glance_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} +transport_url = {{ glance_oslomsg_rpc_transport }}://{% for host in glance_oslomsg_rpc_servers.split(',') %}{{ glance_oslomsg_rpc_userid }}:{{ glance_oslomsg_rpc_password }}@{{ host }}:{{ glance_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _glance_oslomsg_rpc_vhost_conf }}{% if glance_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ glance_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ glance_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} scrub_time = 43200 @@ -70,10 +70,17 @@ policy_file = {{ glance_policy_file }} policy_default_rule = {{ glance_policy_default_rule }} policy_dirs = {{ glance_policy_dirs }} +{% if glance_oslomsg_rpc_transport == 'rabbit' %} +[oslo_messaging_rabbit] +rabbit_quorum_queue = {{ glance_oslomsg_rabbit_quorum_queues }} +rabbit_quorum_delivery_limit = {{ glance_oslomsg_rabbit_quorum_delivery_limit }} +rabbit_quorum_max_memory_bytes = {{ glance_oslomsg_rabbit_quorum_max_memory_bytes }} +{% endif %} + [oslo_messaging_notifications] topics = notifications driver = {{ (glance_ceilometer_enabled | bool) | ternary('messagingv2', 'noop') }} -transport_url = {{ glance_oslomsg_notify_transport }}://{% for host in glance_oslomsg_notify_servers.split(',') %}{{ glance_oslomsg_notify_userid }}:{{ glance_oslomsg_notify_password }}@{{ host }}:{{ glance_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ glance_oslomsg_notify_vhost }}{% if glance_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ glance_oslomsg_notify_ssl_version }}&ssl_ca_file={{ glance_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} +transport_url = {{ glance_oslomsg_notify_transport }}://{% for host in glance_oslomsg_notify_servers.split(',') %}{{ glance_oslomsg_notify_userid }}:{{ glance_oslomsg_notify_password }}@{{ host }}:{{ glance_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _glance_oslomsg_notify_vhost_conf }}{% if glance_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ glance_oslomsg_notify_ssl_version }}&ssl_ca_file={{ glance_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} [paste_deploy] flavor = {{ glance_flavor }} diff --git a/vars/main.yml b/vars/main.yml index a4f903c7..6836138e 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -19,6 +19,9 @@ _glance_is_first_play_host: >- inventory_hostname == (groups[glance_services['glance-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }} +_glance_oslomsg_rpc_vhost_conf: "{{ (glance_oslomsg_rpc_vhost is string) | ternary(glance_oslomsg_rpc_vhost, glance_oslomsg_rpc_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first) }}" +_glance_oslomsg_notify_vhost_conf: "{{ (glance_oslomsg_notify_vhost is string) | ternary(glance_oslomsg_notify_vhost, glance_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.