Hi Nguyễn,

I have tried your config but getting syntax errors, what version of rabbit are you running?  i have created file and added your config: /etc/rabbitmq/rabbitmq_definitions.jso

Getting the following error and I am running Ubuntu 22.04 and Zed release 

TASK [rabbitmq : Copying over definitions.json] **********************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: }
failed: [ctrl1] (item=/etc/kolla/config/rabbitmq/definitions.json) => {"ansible_loop_var": "item", "changed": false, "item": "/etc/kolla/config/rabbitmq/definitions.json", "msg": "AnsibleError: template error while templating string: Unexpected end of template. Jinja was looking for the following tags: 'elif' or 'else' or 'endif'. The innermost block that needs to be closed is 'if'.. String: {\n  \"vhosts\": [\n    {\"name\": \"/\"}{% if project_name == 'outward_rabbitmq' %},\n    {\"name\": \"{{ murano_agent_rabbitmq_vhost }}\"}\n    {% endif %}\n  ],\n  \"users\": [\n    {\"name\": \"{{ role_rabbitmq_user }}\", \"password\": \"{{ role_rabbitmq_password }}\", \"tags\": \"administrator\"}{% if role_rabbitmq_monitoring_user is defined and role_rabbitmq_monitoring_user %},\n    {\"name\": \"{{ role_rabbitmq_monitoring_user }}\", \"password\": \"{{ role_rabbitmq_monitoring_password }}\", \"tags\": \"monitoring\"}{% endif %}{% if project_name == 'outward_rabbitmq' %},\n    {\"name\": \"{{ murano_agent_rabbitmq_user }}\", \"password\": \"{{ murano_agent_rabbitmq_password }}\", \"tags\": \"management\"}\n    {% endif %}\n  ],\n  \"permissions\": [\n    {\"user\": \"{{ role_rabbitmq_user }}\", \"vhost\": \"/\", \"configure\": \".*\", \"write\": \".*\", \"read\": \".*\"}{% if role_rabbitmq_monitoring_user is defined and role_rabbitmq_monitoring_user %},\n    {\"user\": \"{{ role_rabbitmq_monitoring_user }}\", \"vhost\": \"/\", \"configure\": \"^$\", \"write\": \"^$\", \"read\": \".*\"}{% endif %}{% if project_name == 'outward_rabbitmq' %},\n    {\"user\": \"{{ murano_agent_rabbitmq_user }}\", \"vhost\": \"{{ murano_agent_rabbitmq_vhost }}\", \"configure\": \".*\", \"write\": \".*\", \"read\": \".*\"}\n    {% endif %}\n  ],\n  \"policies\":[\"{\"vhost\": \"/\", \"name\": \"ha-all\", \"pattern\": \"^(?!(amq\\.)|(.*_fanout_)|(reply_)).*\", \"apply-to\": \"all\", \"definition\": {\"ha-mode\":\"all\"}, \"priority\":0}{% if project_name == 'outward_rabbitmq' %}\"]\n}\n"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: }
failed: [ctrl2] (item=/etc/kolla/config/rabbitmq/definitions.json) => {"ansible_loop_var": "item", "changed": false, "item": "/etc/kolla/config/rabbitmq/definitions.json", "msg": "AnsibleError: template error while templating string: Unexpected end of template. Jinja was looking for the following tags: 'elif' or 'else' or 'endif'. The innermost block that needs to be closed is 'if'.. String: {\n  \"vhosts\": [\n    {\"name\": \"/\"}{% if project_name == 'outward_rabbitmq' %},\n    {\"name\": \"{{ murano_agent_rabbitmq_vhost }}\"}\n    {% endif %}\n  ],\n  \"users\": [\n    {\"name\": \"{{ role_rabbitmq_user }}\", \"password\": \"{{ role_rabbitmq_password }}\", \"tags\": \"administrator\"}{% if role_rabbitmq_monitoring_user is defined and role_rabbitmq_monitoring_user %},\n    {\"name\": \"{{ role_rabbitmq_monitoring_user }}\", \"password\": \"{{ role_rabbitmq_monitoring_password }}\", \"tags\": \"monitoring\"}{% endif %}{% if project_name == 'outward_rabbitmq' %},\n    {\"name\": \"{{ murano_agent_rabbitmq_user }}\", \"password\": \"{{ murano_agent_rabbitmq_password }}\", \"tags\": \"management\"}\n    {% endif %}\n  ],\n  \"permissions\": [\n    {\"user\": \"{{ role_rabbitmq_user }}\", \"vhost\": \"/\", \"configure\": \".*\", \"write\": \".*\", \"read\": \".*\"}{% if role_rabbitmq_monitoring_user is defined and role_rabbitmq_monitoring_user %},\n    {\"user\": \"{{ role_rabbitmq_monitoring_user }}\", \"vhost\": \"/\", \"configure\": \"^$\", \"write\": \"^$\", \"read\": \".*\"}{% endif %}{% if project_name == 'outward_rabbitmq' %},\n    {\"user\": \"{{ murano_agent_rabbitmq_user }}\", \"vhost\": \"{{ murano_agent_rabbitmq_vhost }}\", \"configure\": \".*\", \"write\": \".*\", \"read\": \".*\"}\n    {% endif %}\n  ],\n  \"policies\":[\"{\"vhost\": \"/\", \"name\": \"ha-all\", \"pattern\": \"^(?!(amq\\.)|(.*_fanout_)|(reply_)).*\", \"apply-to\": \"all\", \"definition\": {\"ha-mode\":\"all\"}, \"priority\":0}{% if project_name == 'outward_rabbitmq' %}\"]\n}\n"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: }
failed: [ctrl3] (item=/etc/kolla/config/rabbitmq/definitions.json) => {"ansible_loop_var": "item", "changed": false, "item": "/etc/kolla/config/rabbitmq/definitions.json", "msg": "AnsibleError: template error while templating string: Unexpected end of template. Jinja was looking for the following tags: 'elif' or 'else' or 'endif'. The innermost block that needs to be closed is 'if'.. String: {\n  \"vhosts\": [\n    {\"name\": \"/\"}{% if project_name == 'outward_rabbitmq' %},\n    {\"name\": \"{{ murano_agent_rabbitmq_vhost }}\"}\n    {% endif %}\n  ],\n  \"users\": [\n    {\"name\": \"{{ role_rabbitmq_user }}\", \"password\": \"{{ role_rabbitmq_password }}\", \"tags\": \"administrator\"}{% if role_rabbitmq_monitoring_user is defined and role_rabbitmq_monitoring_user %},\n    {\"name\": \"{{ role_rabbitmq_monitoring_user }}\", \"password\": \"{{ role_rabbitmq_monitoring_password }}\", \"tags\": \"monitoring\"}{% endif %}{% if project_name == 'outward_rabbitmq' %},\n    {\"name\": \"{{ murano_agent_rabbitmq_user }}\", \"password\": \"{{ murano_agent_rabbitmq_password }}\", \"tags\": \"management\"}\n    {% endif %}\n  ],\n  \"permissions\": [\n    {\"user\": \"{{ role_rabbitmq_user }}\", \"vhost\": \"/\", \"configure\": \".*\", \"write\": \".*\", \"read\": \".*\"}{% if role_rabbitmq_monitoring_user is defined and role_rabbitmq_monitoring_user %},\n    {\"user\": \"{{ role_rabbitmq_monitoring_user }}\", \"vhost\": \"/\", \"configure\": \"^$\", \"write\": \"^$\", \"read\": \".*\"}{% endif %}{% if project_name == 'outward_rabbitmq' %},\n    {\"user\": \"{{ murano_agent_rabbitmq_user }}\", \"vhost\": \"{{ murano_agent_rabbitmq_vhost }}\", \"configure\": \".*\", \"write\": \".*\", \"read\": \".*\"}\n    {% endif %}\n  ],\n  \"policies\":[\"{\"vhost\": \"/\", \"name\": \"ha-all\", \"pattern\": \"^(?!(amq\\.)|(.*_fanout_)|(reply_)).*\", \"apply-to\": \"all\", \"definition\": {\"ha-mode\":\"all\"}, \"priority\":0}{% if project_name == 'outward_rabbitmq' %}\"]\n}\n"}

PLAY RECAP ***********************************************************************************************************************************************************************
ctrl1                      : ok=12   changed=0    unreachable=0    failed=1    skipped=3    rescued=0    ignored=0
ctrl2                      : ok=12   changed=0    unreachable=0    failed=1    skipped=3    rescued=0    ignored=0
ctrl3                      : ok=11   changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
localhost                  : ok=4    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0




On Fri, Feb 10, 2023 at 12:01 AM Nguyễn Hữu Khôi <nguyenhuukhoinw@gmail.com> wrote:
you will need add 

"{"vhost": "/", "name": "ha-all", "pattern": "^(?!(amq\.)|(.*_fanout_)|(reply_)).*", "apply-to": "all", "definition": {"ha-mode":"all"}, "priority":0}{% if project_name == 'outward_rabbitmq' %}"
to

kolla-ansible/ansible/roles/rabbitmq/templates/definitions.json.j2
 
Nguyen Huu Khoi


On Fri, Feb 10, 2023 at 10:47 AM Satish Patel <satish.txt@gmail.com> wrote:
Folks,

I have deployed 3 node kolla controllers and notice rabbitMQ doesn't have any HA policy for queues. when i rebooted one of the nodes and found some messages got lost. 

Any reason kolla doesn't use HA policies by default? 

If i want to add policies then where should i specify them or any doc you can point me to define policies.