diff --git a/ansible/roles/monasca/handlers/main.yml b/ansible/roles/monasca/handlers/main.yml index e194cf22ee..75cd51c277 100644 --- a/ansible/roles/monasca/handlers/main.yml +++ b/ansible/roles/monasca/handlers/main.yml @@ -150,6 +150,7 @@ - service.enabled | bool - config_json.changed | bool or monasca_notification_confs.changed | bool + or monasca_notification_plugin_templates.changed | bool or monasca_notification_container.changed | bool - name: Restart monasca-persister container diff --git a/ansible/roles/monasca/tasks/config.yml b/ansible/roles/monasca/tasks/config.yml index f09499e922..83654a952b 100644 --- a/ansible/roles/monasca/tasks/config.yml +++ b/ansible/roles/monasca/tasks/config.yml @@ -336,6 +336,27 @@ notify: - Restart monasca-notification container +- name: Check for monasca-notification templates + local_action: stat path="{{ node_custom_config }}/monasca/notification_templates" + run_once: True + register: notification_templates + +- name: Copying over monasca-notification templates + vars: + service: "{{ monasca_services['monasca-notification'] }}" + copy: + src: "{{ node_custom_config }}/monasca/notification_templates" + dest: "{{ node_config_directory }}/monasca-notification/" + mode: "0660" + become: true + register: monasca_notification_plugin_templates + when: + - notification_templates.stat.exists and notification_templates.stat.isdir + - inventory_hostname in groups[service['group']] + - service.enabled | bool + notify: + - Restart monasca-notification container + - name: Copying over monasca-persister config vars: service: "{{ monasca_services['monasca-persister'] }}" diff --git a/ansible/roles/monasca/templates/monasca-notification/monasca-notification.json.j2 b/ansible/roles/monasca/templates/monasca-notification/monasca-notification.json.j2 index 858f9f008a..f154c1515e 100644 --- a/ansible/roles/monasca/templates/monasca-notification/monasca-notification.json.j2 +++ b/ansible/roles/monasca/templates/monasca-notification/monasca-notification.json.j2 @@ -6,6 +6,12 @@ "dest": "/etc/monasca/notification.conf", "owner": "monasca", "perm": "0600" + }, + { + "source": "{{ container_config_directory }}/notification_templates/*", + "dest": "/etc/monasca/", + "owner": "monasca", + "perm": "0600" } ], "permissions": [