openstack-ansible-os_monasca/tasks/monasca_alarms_setup.yml

54 lines
2.1 KiB
YAML

---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Wait for monasca-api to come up
uri:
url: "{{ monasca_service_internalurl }}"
status_code: 401
register: result
until: result|success
retries: 5
delay: 2
- name: Setup default notification method
monasca_notification_method:
name: "{{ monasca_notification_name }}"
type: "{{ monasca_notification_type }}"
address: "{{ monasca_notification_address }}"
keystone_auth_url: "{{ keystone_service_adminurl }}"
keystone_username: "{{ keystone_admin_user_name }}"
keystone_password: "{{ keystone_auth_admin_password }}"
keystone_project_name: "{{ keystone_admin_tenant_name }}"
monasca_api_url: "{{ monasca_service_internalurl }}"
register: default_notification
- name: Create default alarm definitions
monasca_alarm_definition:
name: "{{ item.name }}"
description: "{{ item.description | default('') }}"
expression: "{{ item.expression }}"
match_by: "{{ item.match_by | default(['hostname']) }}"
severity: "{{ item.severity | default('LOW') }}"
alarm_actions:
- "{{ default_notification.notification_method_id }}"
ok_actions:
- "{{ default_notification.notification_method_id }}"
undetermined_actions:
- "{{ default_notification.notification_method_id }}"
keystone_auth_url: "{{ keystone_service_adminurl }}"
keystone_username: "{{ keystone_admin_user_name }}"
keystone_password: "{{ keystone_auth_admin_password }}"
keystone_project_name: "{{ keystone_admin_tenant_name }}"
monasca_api_url: "{{ monasca_service_internalurl }}"
with_items: "{{ monasca_default_alarms }}"