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