Merge "M/N upgrade sahara-api fails to restart."
[apex-tripleo-heat-templates.git] / puppet / services / services.yaml
1 heat_template_version: 2016-10-14
2
3 description: >
4   Utility stack to convert an array of services into a set of combined
5   role configs.
6
7 parameters:
8   Services:
9     default: []
10     description: |
11         List nested stack service templates.
12     type: comma_delimited_list
13   ServiceNetMap:
14     default: {}
15     description: Mapping of service_name -> network name. Typically set
16                  via parameter_defaults in the resource registry.  This
17                  mapping overrides those in ServiceNetMapDefaults.
18     type: json
19   EndpointMap:
20     default: {}
21     description: Mapping of service endpoint -> protocol. Typically set
22                  via parameter_defaults in the resource registry.
23     type: json
24   DefaultPasswords:
25     default: {}
26     description: Mapping of service -> default password. Used to help
27                  pass top level passwords managed by Heat into services.
28     type: json
29
30 resources:
31
32   ServiceChain:
33     type: OS::Heat::ResourceChain
34     properties:
35       resources: {get_param: Services}
36       concurrent: true
37       resource_properties:
38         ServiceNetMap: {get_param: ServiceNetMap}
39         EndpointMap: {get_param: EndpointMap}
40         DefaultPasswords: {get_param: DefaultPasswords}
41
42   LoggingConfiguration:
43     type: OS::TripleO::LoggingConfiguration
44
45 outputs:
46   role_data:
47     description: Combined Role data for this set of services.
48     value:
49       service_names:
50         # Filter any null/None service_names which may be present due to mapping
51         # of services to OS::Heat::None
52         yaql:
53           expression: list($.data.s_names.where($ != null))
54           data: {s_names: {get_attr: [ServiceChain, role_data, service_name]}}
55       monitoring_subscriptions:
56         yaql:
57           expression: list($.data.subscriptions.where($ != null))
58           data: {subscriptions: {get_attr: [ServiceChain, role_data, monitoring_subscription]}}
59       logging_sources:
60         # Transform the individual logging_source configuration from
61         # each service in the chain into a global list, adding some
62         # default configuration at the same time.
63         yaql:
64           expression: >
65             let(
66             default_format => $.data.default_format,
67             pos_file_path => $.data.pos_file_path,
68             sources => $.data.sources.flatten()
69             ) ->
70             $sources.where($ != null).select({
71             'type' => 'tail',
72             'tag' => $.tag,
73             'path' => $.path,
74             'format' => $.get('format', $default_format),
75             'pos_file' => $.get('pos_file', $pos_file_path + '/' + $.tag + '.pos')
76             })
77           data:
78             sources:
79               - {get_attr: [LoggingConfiguration, LoggingDefaultSources]}
80               - {get_attr: [ServiceChain, role_data, logging_source]}
81               - {get_attr: [LoggingConfiguration, LoggingExtraSources]}
82             default_format: {get_attr: [LoggingConfiguration, LoggingDefaultFormat]}
83             pos_file_path: {get_attr: [LoggingConfiguration, LoggingPosFilePath]}
84       logging_groups:
85         # Build a list of unique groups to which we should add the
86         # fluentd user.
87         yaql:
88           expression: >
89             set($.data.groups.flatten()).where($)
90           data:
91             groups:
92               - [{get_attr: [LoggingConfiguration, LoggingDefaultGroups]}]
93               - {get_attr: [ServiceChain, role_data, logging_groups]}
94               - [{get_attr: [LoggingConfiguration, LoggingExtraGroups]}]
95       config_settings: {map_merge: {get_attr: [ServiceChain, role_data, config_settings]}}
96       global_config_settings:
97         map_merge:
98           yaql:
99             expression: list($.data.configs.where($ != null))
100             data: {configs: {get_attr: [ServiceChain, role_data, global_config_settings]}}
101       step_config: {list_join: ["\n", {get_attr: [ServiceChain, role_data, step_config]}]}