kolla-ansible/ansible/roles/monasca/tasks/config.yml
Doug Szumski 9c88262ad9 Support deploying Monasca Log Transformer
The Monasca Log Transformer takes raw, unstandardised logs from one
Kafka topic, standardises them with whatever rules the operator wants
to use, and then writes them to a standardised logs topic in Kafka. It
is currently implemented as a Logstash config file.

Since Kolla does a fairly good job of standardising logs, this service
does very little processing. However, when other sources of logs
are used, it may be useful to add rules to the Transformer, particularly
if it's not possible to standardise the logs at source.

Ingesting the logs from this service with Fluentd will be covered under
a different commit.

Change-Id: I31cbb7e9a40a848391f517a56a67e3fd5bc12529
Partially-Implements: blueprint monasca-roles
2018-07-05 17:33:53 +01:00

137 lines
4.2 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-config.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: 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 }}"
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"