Support custom monasca-notification templates

Jira, Slack and possiblly other plugins allow custom templates
for defining the format of notifications. This change lets you
provide these in a templates folder which is copied into the
monasca-notification container.

Partially-Implements: blueprint monasca-roles
Change-Id: Ibc5ba3944d51f6c8ffc8bdc9ed60f43dd91ca7e0
This commit is contained in:
Doug Szumski 2018-10-08 16:56:04 +01:00
parent 1d5a184a96
commit 1feb6b6aaa
3 changed files with 28 additions and 0 deletions
ansible/roles/monasca
handlers
tasks
templates/monasca-notification

@ -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

@ -236,6 +236,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'] }}"

@ -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": [