diff --git a/defaults/main.yml b/defaults/main.yml index 4d7932ea..d01a820c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -196,10 +196,19 @@ swift_oslomsg_notify_servers: "{{ oslomsg_notify_servers | default('127.0.0.1') swift_oslomsg_notify_port: "{{ oslomsg_notify_port | default('5672') }}" swift_oslomsg_notify_use_ssl: "{{ oslomsg_notify_use_ssl | default(False) }}" swift_oslomsg_notify_userid: swift -swift_oslomsg_notify_vhost: /swift +swift_oslomsg_notify_vhost: + - name: /swift + state: "{{ swift_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}" + - name: swift + state: "{{ swift_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}" + swift_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_2') }}" swift_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}" +swift_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}" +swift_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}" +swift_oslomsg_rabbit_quorum_max_memory_bytes: "{{ oslomsg_rabbit_quorum_max_memory_bytes | default(0) }}" + ## General Swift configuration # We are not capping the default value for these swift variables which define # the number of worker threads for each of the swift services (except the swift diff --git a/templates/proxy-server.conf.j2 b/templates/proxy-server.conf.j2 index 7120c6eb..f7f910cb 100644 --- a/templates/proxy-server.conf.j2 +++ b/templates/proxy-server.conf.j2 @@ -176,7 +176,7 @@ use = egg:swift#xprofile paste.filter_factory = ceilometermiddleware.swift:filter_factory control_exchange = swift driver = messagingv2 -url = {{ swift_oslomsg_notify_transport }}://{% for host in swift_oslomsg_notify_servers.split(',') %}{{ swift_oslomsg_notify_userid }}:{{ swift_oslomsg_notify_password }}@{{ host }}:{{ swift_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ swift_oslomsg_notify_vhost }}{% if swift_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ swift_oslomsg_notify_ssl_version }}&ssl_ca_file={{ swift_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} +url = {{ swift_oslomsg_notify_transport }}://{% for host in swift_oslomsg_notify_servers.split(',') %}{{ swift_oslomsg_notify_userid }}:{{ swift_oslomsg_notify_password }}@{{ host }}:{{ swift_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _swift_oslomsg_notify_vhost_conf }}{% if swift_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ swift_oslomsg_notify_ssl_version }}&ssl_ca_file={{ swift_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} topic = notifications {% if gnocchi_service_project_name is defined %} diff --git a/vars/main.yml b/vars/main.yml index bf742a91..23a65736 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -21,6 +21,12 @@ _swift_proxy_is_first_play_host: >- _swift_is_first_play_host: >- {{ ('swift_hosts' in group_names and inventory_hostname == (groups['swift_hosts'] | intersect(ansible_play_hosts)) | first) | bool }} +_swift_oslomsg_notify_vhost_conf: >- + {{ + (swift_oslomsg_notify_vhost is string) | ternary( + swift_oslomsg_notify_vhost, swift_oslomsg_notify_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first) + }} + filtered_swift_services: |- {% set services = [] %} {% for key,value in swift_services.items() %}