kolla-ansible/ansible/roles/monasca/tasks/config.yml
Doug Szumski 1ae10375f7 Support deploying Monasca Log Metrics
The log metrics service generates metrics from log messages
which allows further analysis and alerting to be performed
on them. Basic configuration is provided so that metrics
are generated for high level warning logs such as error, or
warning.

Change-Id: I45cc17817c716296451f620f304c0b1108162a56
Partially-Implements: blueprint monasca-roles
2018-09-25 16:36:14 +00:00

195 lines
6.3 KiB
YAML

---
- name: Ensuring config directories exist
file:
path: "{{ node_config_directory }}/{{ item.key }}"
state: "directory"
owner: "{{ config_owner_user }}"
group: "{{ config_owner_group }}"
mode: "0770"
recurse: yes
become: true
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ monasca_services }}"
- name: Copying over config.json files for services
template:
src: "{{ item.key }}/{{ item.key }}.json.j2"
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
mode: "0660"
become: true
register: monasca_config_jsons
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ monasca_services }}"
notify:
- "Restart {{ item.key }} container"
- name: Copying over monasca-api config
vars:
service: "{{ monasca_services['monasca-api'] }}"
merge_configs:
sources:
- "{{ role_path }}/templates/monasca-api/{{ item }}.j2"
- "{{ node_custom_config }}/monasca/{{ item }}"
- "{{ node_custom_config }}/monasca/{{ inventory_hostname }}/{{ item }}"
dest: "{{ node_config_directory }}/monasca-api/{{ item }}"
mode: "0660"
become: true
register: monasca_api_confs
with_items:
- api.conf
- api-config.ini
when:
- inventory_hostname in groups[service['group']]
- service.enabled | bool
notify:
- Restart monasca-api container
- name: Copying over monasca-api wsgi config
vars:
service: "{{ monasca_services['monasca-api'] }}"
template:
src: "{{ role_path }}/templates/monasca-api/wsgi-api.conf.j2"
dest: "{{ node_config_directory }}/monasca-api/wsgi-api.conf"
mode: "0660"
become: true
register: monasca_api_wsgi_confs
when:
- inventory_hostname in groups[service['group']]
- service.enabled | bool
notify:
- Restart monasca-api container
- name: Copying over monasca-log-api config
vars:
service: "{{ monasca_services['monasca-log-api'] }}"
merge_configs:
sources:
- "{{ role_path }}/templates/monasca-log-api/{{ item }}.j2"
- "{{ node_custom_config }}/monasca/{{ item }}"
- "{{ node_custom_config }}/monasca/{{ inventory_hostname }}/{{ item }}"
dest: "{{ node_config_directory }}/monasca-log-api/{{ item }}"
mode: "0660"
become: true
register: monasca_log_api_confs
with_items:
- log-api.conf
- log-api-paste.ini
when:
- inventory_hostname in groups[service['group']]
- service.enabled | bool
notify:
- Restart monasca-log-api container
- name: Copying over monasca-log-api wsgi config
vars:
service: "{{ monasca_services['monasca-log-api'] }}"
template:
src: "{{ role_path }}/templates/monasca-log-api/wsgi-log-api.conf.j2"
dest: "{{ node_config_directory }}/monasca-log-api/wsgi-log-api.conf"
mode: "0660"
become: true
register: monasca_log_api_wsgi_confs
when:
- inventory_hostname in groups[service['group']]
- service.enabled | bool
notify:
- Restart monasca-log-api container
- name: Copying over monasca-log-transformer config
vars:
service: "{{ monasca_services['monasca-log-transformer'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/monasca-log-transformer/log-transformer.conf"
mode: "0660"
become: true
register: monasca_log_transformer_confs
with_first_found:
- "{{ node_custom_config }}/monasca/{{ inventory_hostname }}/log-transformer.conf"
- "{{ node_custom_config }}/monasca/log-transformer.conf"
- "{{ role_path }}/templates/monasca-log-transformer/log-transformer.conf.j2"
when:
- inventory_hostname in groups[service['group']]
- service.enabled | bool
notify:
- Restart monasca-log-transformer container
- name: Copying over monasca-log-persister config
vars:
service: "{{ monasca_services['monasca-log-persister'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/monasca-log-persister/log-persister.conf"
mode: "0660"
become: true
register: monasca_log_persister_confs
with_first_found:
- "{{ node_custom_config }}/monasca/{{ inventory_hostname }}/log-persister.conf"
- "{{ node_custom_config }}/monasca/log-persister.conf"
- "{{ role_path }}/templates/monasca-log-persister/log-persister.conf.j2"
when:
- inventory_hostname in groups[service['group']]
- service.enabled | bool
notify:
- Restart monasca-log-persister container
- name: Copying over monasca-log-persister elasticsearch template
vars:
service: "{{ monasca_services['monasca-log-persister'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/monasca-log-persister/elasticsearch-template.json"
mode: "0660"
become: true
register: monasca_log_persister_elasticsearch_template
with_first_found:
- "{{ node_custom_config }}/monasca/{{ inventory_hostname }}/elasticsearch-template.json"
- "{{ node_custom_config }}/monasca/elasticsearch-template.json"
- "{{ role_path }}/templates/monasca-log-persister/elasticsearch-template.json"
when:
- inventory_hostname in groups[service['group']]
- service.enabled | bool
notify:
- Restart monasca-log-persister container
- name: Copying over monasca-log-metrics config
vars:
service: "{{ monasca_services['monasca-log-metrics'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/monasca-log-metrics/log-metrics.conf"
mode: "0660"
become: true
register: monasca_log_metrics_confs
with_first_found:
- "{{ node_custom_config }}/monasca/{{ inventory_hostname }}/log-metrics.conf"
- "{{ node_custom_config }}/monasca/log-metrics.conf"
- "{{ role_path }}/templates/monasca-log-metrics/log-metrics.conf.j2"
when:
- inventory_hostname in groups[service['group']]
- service.enabled | bool
notify:
- Restart monasca-log-metrics container
- name: Check monasca containers
become: true
kolla_docker:
action: "compare_container"
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
volumes: "{{ item.value.volumes }}"
dimensions: "{{ item.value.dimensions }}"
register: check_monasca_containers
when:
- kolla_action != "config"
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ monasca_services }}"
notify:
- "Restart {{ item.key }} container"