Changed messaging_urls for notification agent

Regarding ceilometer docs, messaging_urls is expected to be:
rabbit://user:pass@host1:port1[,user:pass@hostN:portN]/virtual_host
But we have a bunch of messaging_urls for every rabbit vhost.
Ref: https://docs.openstack.org/ceilometer/latest/configuration/

As a result macros for generation of transport_url and
messaging_urls was created.

notification section was removed for non-notification agent hosts.

Change-Id: Ieb30c66df41dfe75937b9463527d250e05d868a0
This commit is contained in:
Dmitriy Rabotjagov 2018-09-05 17:24:38 +03:00
parent 6e0502655a
commit f03f812d26
1 changed files with 24 additions and 28 deletions

View File

@ -1,4 +1,16 @@
#{{ ansible_managed}}
{% macro _oslomsg_url(transport, userid, password, hosts, port, vhost, query='', ip_from_hostnames=true) %}
{% set _url = [] %}
{% for host in hosts %}
{% if ip_from_hostnames %}
{% set host_address = hostvars[host]['ansible_host'] %}
{% else %}
{% set host_address = host %}
{% endif %}
{% set _ = _url.append(userid + ':' + password + '@' + host_address + ':' + port) %}
{% endfor %}
{{ transport }}://{{ _url | join(',') }}/{{ vhost }}?{{ query }}
{% endmacro %}
[DEFAULT]
use_journal = True
@ -9,7 +21,7 @@ auth_strategy = keystone
aodh_is_enabled = {{ ceilometer_aodh_enabled | bool }}
# RPC
transport_url = {{ ceilometer_oslomsg_rpc_transport }}://{% for host in ceilometer_oslomsg_rpc_servers.split(',') %}{{ ceilometer_oslomsg_rpc_userid }}:{{ ceilometer_oslomsg_rpc_password }}@{{ host }}:{{ ceilometer_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ ceilometer_oslomsg_rpc_vhost }}{% if ceilometer_oslomsg_rpc_use_ssl | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ _oslomsg_url(ceilometer_oslomsg_rpc_transport, ceilometer_oslomsg_rpc_userid, ceilometer_oslomsg_rpc_password, ceilometer_oslomsg_rpc_servers.split(','), ceilometer_oslomsg_rpc_port, ceilometer_oslomsg_rpc_vhost, ip_from_hostnames=false, query=(ceilometer_oslomsg_rpc_use_ssl | bool | ternary('ssl=1', ''))) }}
{% if ceilometer_gnocchi_enabled | bool %}
event_dispatchers = gnocchi
@ -29,6 +41,7 @@ ssl = {{ ceilometer_oslomsg_rpc_use_ssl }}
[api]
gnocchi_is_enabled = {{ ceilometer_gnocchi_enabled | bool }}
{% if 'ceilometer_agent_notification' in group_names %}
[notification]
workers = {{ ceilometer_notification_workers }}
store_events = {{ not ceilometer_gnocchi_enabled | bool }}
@ -36,64 +49,47 @@ store_events = {{ not ceilometer_gnocchi_enabled | bool }}
# Notification queues to listen on
# Ceilometer needs to connect to it's own notification vhost
{% for host in groups[ceilometer_oslomsg_notify_host_group] %}
messaging_urls = {{ ceilometer_oslomsg_notify_transport }}://{{ ceilometer_oslomsg_notify_userid }}:{{ ceilometer_oslomsg_notify_password }}@{{ hostvars[host]['ansible_host'] }}:{{ ceilometer_oslomsg_notify_port }}/{{ ceilometer_oslomsg_notify_vhost }}
{% endfor %}
messaging_urls = {{ _oslomsg_url(ceilometer_oslomsg_notify_transport, ceilometer_oslomsg_notify_userid, ceilometer_oslomsg_notify_password, groups[ceilometer_oslomsg_notify_host_group], ceilometer_oslomsg_notify_port, ceilometer_oslomsg_notify_vhost) }}
{% if glance_ceilometer_enabled %}
# Glance notifications
{% for host in groups[glance_oslomsg_notify_host_group] %}
messaging_urls = {{ glance_oslomsg_notify_transport }}://{{ glance_oslomsg_notify_userid }}:{{ glance_oslomsg_notify_password }}@{{ hostvars[host]['ansible_host'] }}:{{ glance_oslomsg_notify_port }}/{{ glance_oslomsg_notify_vhost }}
{% endfor %}
messaging_urls = {{ _oslomsg_url(glance_oslomsg_notify_transport, glance_oslomsg_notify_userid, glance_oslomsg_notify_password, groups[glance_oslomsg_notify_host_group], glance_oslomsg_notify_port, glance_oslomsg_notify_vhost) }}
{% endif %}
{% if nova_ceilometer_enabled %}
# Nova notifications
{% for host in groups[nova_oslomsg_notify_host_group] %}
messaging_urls = {{ nova_oslomsg_notify_transport }}://{{ nova_oslomsg_notify_userid }}:{{ nova_oslomsg_notify_password }}@{{ hostvars[host]['ansible_host'] }}:{{ nova_oslomsg_notify_port }}/{{ nova_oslomsg_notify_vhost }}
{% endfor %}
messaging_urls = {{ _oslomsg_url(nova_oslomsg_notify_transport, nova_oslomsg_notify_userid, nova_oslomsg_notify_password, groups[nova_oslomsg_notify_host_group], nova_oslomsg_notify_port, nova_oslomsg_notify_vhost) }}
{% endif %}
{% if cinder_ceilometer_enabled %}
# Cinder notifications
{% for host in groups[cinder_oslomsg_notify_host_group] %}
messaging_urls = {{ cinder_oslomsg_notify_transport }}://{{ cinder_oslomsg_notify_userid }}:{{ cinder_oslomsg_notify_password }}@{{ hostvars[host]['ansible_host'] }}:{{ cinder_oslomsg_notify_port }}/{{ cinder_oslomsg_notify_vhost }}
{% endfor %}
messaging_urls = {{ _oslomsg_url(cinder_oslomsg_notify_transport, cinder_oslomsg_notify_userid, cinder_oslomsg_notify_password, groups[cinder_oslomsg_notify_host_group], cinder_oslomsg_notify_port, cinder_oslomsg_notify_vhost) }}
{% endif %}
{% if neutron_ceilometer_enabled %}
# Neutron notifications
{% for host in groups[neutron_oslomsg_notify_host_group] %}
messaging_urls = {{ neutron_oslomsg_notify_transport }}://{{ neutron_oslomsg_notify_userid }}:{{ neutron_oslomsg_notify_password }}@{{ hostvars[host]['ansible_host'] }}:{{ neutron_oslomsg_notify_port }}/{{ neutron_oslomsg_notify_vhost }}
{% endfor %}
messaging_urls = {{ _oslomsg_url(neutron_oslomsg_notify_transport, neutron_oslomsg_notify_userid, neutron_oslomsg_notify_password, groups[neutron_oslomsg_notify_host_group], neutron_oslomsg_notify_port, neutron_oslomsg_notify_vhost) }}
{% endif %}
{% if heat_ceilometer_enabled %}
# Heat notifications
{% for host in groups[heat_oslomsg_notify_host_group] %}
messaging_urls = {{ heat_oslomsg_notify_transport }}://{{ heat_oslomsg_notify_userid }}:{{ heat_oslomsg_notify_password }}@{{ hostvars[host]['ansible_host'] }}:{{ heat_oslomsg_notify_port }}/{{ heat_oslomsg_notify_vhost }}
{% endfor %}
messaging_urls = {{ _oslomsg_url(heat_oslomsg_notify_transport, heat_oslomsg_notify_userid, heat_oslomsg_notify_password, groups[heat_oslomsg_notify_host_group], heat_oslomsg_notify_port, heat_oslomsg_notify_vhost) }}
{% endif %}
{% if keystone_ceilometer_enabled %}
# Keystone notifications
{% for host in groups[keystone_oslomsg_notify_host_group] %}
messaging_urls = {{ keystone_oslomsg_notify_transport }}://{{ keystone_oslomsg_notify_userid }}:{{ keystone_oslomsg_notify_password }}@{{ hostvars[host]['ansible_host'] }}:{{ keystone_oslomsg_notify_port }}/{{ keystone_oslomsg_notify_vhost }}
{% endfor %}
messaging_urls = {{ _oslomsg_url(keystone_oslomsg_notify_transport, keystone_oslomsg_notify_userid, keystone_oslomsg_notify_password, groups[keystone_oslomsg_notify_host_group], keystone_oslomsg_notify_port, keystone_oslomsg_notify_vhost) }}
{% endif %}
{% if swift_ceilometer_enabled %}
# Ceilometer notifications
{% for host in groups[swift_oslomsg_notify_host_group] %}
messaging_urls = {{ swift_oslomsg_notify_transport }}://{{ swift_oslomsg_notify_userid }}:{{ swift_oslomsg_notify_password }}@{{ hostvars[host]['ansible_host'] }}:{{ swift_oslomsg_notify_port }}/{{ swift_oslomsg_notify_vhost }}
{% endfor %}
messaging_urls = {{ _oslomsg_url(swift_oslomsg_notify_transport, swift_oslomsg_notify_userid, swift_oslomsg_notify_password, groups[swift_oslomsg_notify_host_group], swift_oslomsg_notify_port, swift_oslomsg_notify_vhost) }}
{% endif %}
{% if sahara_ceilometer_enabled %}
# Sahara notifications
{% for host in groups[sahara_oslomsg_notify_host_group] %}
messaging_urls = {{ sahara_oslomsg_notify_transport }}://{{ sahara_oslomsg_notify_userid }}:{{ sahara_oslomsg_notify_password }}@{{ hostvars[host]['ansible_host'] }}:{{ sahara_oslomsg_notify_port }}/{{ sahara_oslomsg_notify_vhost }}
{% endfor %}
messaging_urls = {{ _oslomsg_url(sahara_oslomsg_notify_transport, sahara_oslomsg_notify_userid, sahara_oslomsg_notify_password, groups[sahara_oslomsg_notify_host_group], sahara_oslomsg_notify_port, sahara_oslomsg_notify_vhost) }}
{% endif %}
{% endif %}
{% if ceilometer_gnocchi_enabled | bool %}