e34f31fa3d8f3399e9793a149416b77cd35d8827
[apex-tripleo-heat-templates.git] / puppet / services / logging / fluentd-client.yaml
1 heat_template_version: pike
2
3 description: Fluentd client configured with Puppet
4
5 parameters:
6   ServiceNetMap:
7     default: {}
8     description: Mapping of service_name -> network name. Typically set
9                  via parameter_defaults in the resource registry.  This
10                  mapping overrides those in ServiceNetMapDefaults.
11     type: json
12   DefaultPasswords:
13     default: {}
14     type: json
15   RoleName:
16     default: ''
17     description: Role name on which the service is applied
18     type: string
19   RoleParameters:
20     default: {}
21     description: Parameters specific to the role
22     type: json
23   EndpointMap:
24     default: {}
25     description: >
26       Mapping of service endpoint -> protocol. Typically set
27       via parameter_defaults in the resource registry.
28     type: json
29
30 resources:
31   FluentdBase:
32     type: ./fluentd-base.yaml
33     properties:
34       EndpointMap: {get_param: EndpointMap}
35       RoleName: {get_param: RoleName}
36       RoleParameters: {get_param: RoleParameters}
37       ServiceNetMap: {get_param: ServiceNetMap}
38       DefaultPasswords: {get_param: DefaultPasswords}
39
40   LoggingConfiguration:
41     type: OS::TripleO::LoggingConfiguration
42
43 outputs:
44   role_data:
45     description: Role data for the Fluentd client role.
46     value:
47       service_name: fluentd_client
48       config_settings:
49         map_merge:
50           - get_attr: [FluentdBase, role_data, config_settings]
51           - tripleo::profile::base::logging::fluentd::fluentd_servers:
52               get_attr: [LoggingConfiguration, LoggingServers]
53             tripleo::profile::base::logging::fluentd::fluentd_filters:
54               yaql:
55                 expression: >
56                   $.data.filters.flatten().where($)
57                 data:
58                   filters:
59                     - get_attr: [LoggingConfiguration, LoggingDefaultFilters]
60                     - get_attr: [LoggingConfiguration, LoggingExtraFilters]
61             tripleo::profile::base::logging::fluentd::fluentd_pos_file_path:
62               get_attr: [LoggingConfiguration, LoggingPosFilePath]
63             tripleo::profile::base::logging::fluentd::fluentd_use_ssl:
64               get_attr: [LoggingConfiguration, LoggingUsesSSL]
65             tripleo::profile::base::logging::fluentd::fluentd_ssl_certificate:
66               get_attr: [LoggingConfiguration, LoggingSSLCertificate]
67             tripleo::profile::base::logging::fluentd::fluentd_ssl_key:
68               get_attr: [LoggingConfiguration, LoggingSSLKey]
69             tripleo::profile::base::logging::fluentd::fluentd_ssl_key_passphrase:
70               get_attr: [LoggingConfiguration, LoggingSSLKeyPassphrase]
71             tripleo::profile::base::logging::fluentd::fluentd_shared_key:
72               get_attr: [LoggingConfiguration, LoggingSharedKey]
73       step_config: |
74         include ::tripleo::profile::base::logging::fluentd
75       upgrade_tasks:
76         - name: Check if fluentd_client is deployed
77           command: systemctl is-enabled fluentd
78           tags: common
79           ignore_errors: True
80           register: fluentd_client_enabled
81         - name: Check status of fluentd service
82           shell: >
83             /usr/bin/systemctl show fluentd --property ActiveState |
84             grep '\bactive\b'
85           when: fluentd_client_enabled.rc == 0
86           tags: step0,validation
87         - name: Stop fluentd service
88           tags: step1
89           when: fluentd_client_enabled.rc == 0
90           service: name=fluentd state=stopped
91         - name: Install fluentd package if it was disabled
92           tags: step3
93           yum: name=fluentd state=latest
94           when: fluentd_client_enabled.rc != 0