Adds network/cidr mapping into a new service property
[apex-tripleo-heat-templates.git] / common / services.yaml
1 #FIXME move into common when specfile adds it
2 heat_template_version: pike
3
4 description: >
5   Utility stack to convert an array of services into a set of combined
6   role configs.
7
8 parameters:
9   Services:
10     default: []
11     description: |
12         List nested stack service templates.
13     type: comma_delimited_list
14   ServiceData:
15     default: {}
16     description: Dictionary packing service data
17     type: json
18   ServiceNetMap:
19     default: {}
20     description: Mapping of service_name -> network name. Typically set
21                  via parameter_defaults in the resource registry.  This
22                  mapping overrides those in ServiceNetMapDefaults.
23     type: json
24   EndpointMap:
25     default: {}
26     description: Mapping of service endpoint -> protocol. Typically set
27                  via parameter_defaults in the resource registry.
28     type: json
29   DefaultPasswords:
30     default: {}
31     description: Mapping of service -> default password. Used to help
32                  pass top level passwords managed by Heat into services.
33     type: json
34   RoleName:
35     default: ''
36     description: Role name on which the service is applied
37     type: string
38   RoleParameters:
39     description: Role Specific parameters to be provided to service
40     default: {}
41     type: json
42
43 resources:
44
45   ServiceChain:
46     type: OS::Heat::ResourceChain
47     properties:
48       resources: {get_param: Services}
49       concurrent: true
50       resource_properties:
51         ServiceData: {get_param: ServiceData}
52         ServiceNetMap: {get_param: ServiceNetMap}
53         EndpointMap: {get_param: EndpointMap}
54         DefaultPasswords: {get_param: DefaultPasswords}
55         RoleName: {get_param: RoleName}
56         RoleParameters: {get_param: RoleParameters}
57
58   LoggingConfiguration:
59     type: OS::TripleO::LoggingConfiguration
60
61   ServiceServerMetadataHook:
62     type: OS::TripleO::ServiceServerMetadataHook
63     properties:
64       RoleData: {get_attr: [ServiceChain, role_data]}
65
66 outputs:
67   role_data:
68     description: Combined Role data for this set of services.
69     value:
70       service_names:
71         {get_attr: [ServiceChain, role_data, service_name]}
72       monitoring_subscriptions:
73         yaql:
74           expression: list($.data.role_data.where($ != null).select($.get('monitoring_subscription')).where($ != null))
75           data: {role_data: {get_attr: [ServiceChain, role_data]}}
76       logging_sources:
77         # Transform the individual logging_source configuration from
78         # each service in the chain into a global list, adding some
79         # default configuration at the same time.
80         yaql:
81           expression: >
82             let(
83             default_format => $.data.default_format,
84             pos_file_path => $.data.pos_file_path,
85             sources => $.data.sources.flatten()
86             ) ->
87             $sources.where($ != null).select({
88             'type' => 'tail',
89             'tag' => $.tag,
90             'path' => $.path,
91             'format' => $.get('format', $default_format),
92             'pos_file' => $.get('pos_file', $pos_file_path + '/' + $.tag + '.pos')
93             })
94           data:
95             sources:
96               - {get_attr: [LoggingConfiguration, LoggingDefaultSources]}
97               - yaql:
98                   expression: list($.data.role_data.where($ != null).select($.get('logging_source')).where($ != null))
99                   data: {role_data: {get_attr: [ServiceChain, role_data]}}
100
101               - {get_attr: [LoggingConfiguration, LoggingExtraSources]}
102             default_format: {get_attr: [LoggingConfiguration, LoggingDefaultFormat]}
103             pos_file_path: {get_attr: [LoggingConfiguration, LoggingPosFilePath]}
104       logging_groups:
105         # Build a list of unique groups to which we should add the
106         # fluentd user.
107         yaql:
108           expression: >
109             set(($.data.default + $.data.extra + $.data.role_data.where($ != null).select($.get('logging_groups'))).flatten()).where($)
110           data:
111             default: {get_attr: [LoggingConfiguration, LoggingDefaultGroups]}
112             extra: {get_attr: [LoggingConfiguration, LoggingExtraGroups]}
113             role_data: {get_attr: [ServiceChain, role_data]}
114       config_settings: {map_merge: {get_attr: [ServiceChain, role_data, config_settings]}}
115       global_config_settings:
116         map_merge:
117           yaql:
118             expression: list($.data.role_data.where($ != null).select($.get('global_config_settings')).where($ != null))
119             data: {role_data: {get_attr: [ServiceChain, role_data]}}
120       service_config_settings:
121         yaql:
122           expression: $.data.role_data.where($ != null).select($.get('service_config_settings')).where($ != null).reduce($1.mergeWith($2), {})
123           data: {role_data: {get_attr: [ServiceChain, role_data]}}
124       service_workflow_tasks:
125         yaql:
126           expression: $.data.role_data.where($ != null).select($.get('service_workflow_tasks')).where($ != null).reduce($1.mergeWith($2), {})
127           data: {role_data: {get_attr: [ServiceChain, role_data]}}
128       step_config: {get_attr: [ServiceChain, role_data, step_config]}
129       upgrade_tasks:
130         yaql:
131           # Note we use distinct() here to filter any identical tasks, e.g yum update for all services
132           expression: $.data.where($ != null).select($.get('upgrade_tasks')).where($ != null).flatten().distinct()
133           data: {get_attr: [ServiceChain, role_data]}
134       upgrade_batch_tasks:
135         yaql:
136           # Note we use distinct() here to filter any identical tasks, e.g yum update for all services
137           expression: $.data.where($ != null).select($.get('upgrade_batch_tasks')).where($ != null).flatten().distinct()
138           data: {get_attr: [ServiceChain, role_data]}
139       service_metadata_settings: {get_attr: [ServiceServerMetadataHook, metadata]}
140
141       # Keys to support docker/services
142       puppet_config: {get_attr: [ServiceChain, role_data, puppet_config]}
143       kolla_config:
144         map_merge: {get_attr: [ServiceChain, role_data, kolla_config]}
145       docker_config:
146         {get_attr: [ServiceChain, role_data, docker_config]}
147       docker_puppet_tasks:
148         {get_attr: [ServiceChain, role_data, docker_puppet_tasks]}
149       host_prep_tasks:
150         yaql:
151           # Note we use distinct() here to filter any identical tasks
152           expression: $.data.where($ != null).select($.get('host_prep_tasks')).where($ != null).flatten().distinct()
153           data: {get_attr: [ServiceChain, role_data]}