Merge "add lbaasv2 to NeutronServicePlugins in octavia containers"
[apex-tripleo-heat-templates.git] / puppet / services / database / mongodb.yaml
1 heat_template_version: pike
2
3 description: >
4   MongoDb service deployment using puppet
5
6 parameters:
7   #Parameters not used EndpointMap
8   ServiceData:
9     default: {}
10     description: Dictionary packing service data
11     type: json
12   ServiceNetMap:
13     default: {}
14     description: Mapping of service_name -> network name. Typically set
15                  via parameter_defaults in the resource registry.  This
16                  mapping overrides those in ServiceNetMapDefaults.
17     type: json
18   DefaultPasswords:
19     default: {}
20     type: json
21   RoleName:
22     default: ''
23     description: Role name on which the service is applied
24     type: string
25   RoleParameters:
26     default: {}
27     description: Parameters specific to the role
28     type: json
29   EndpointMap:
30     default: {}
31     description: Mapping of service endpoint -> protocol. Typically set
32                  via parameter_defaults in the resource registry.
33     type: json
34   MongodbMemoryLimit:
35     default: '20G'
36     description: Limit the amount of memory mongodb uses with systemd.
37     type: string
38   MongoDbLoggingSource:
39     type: json
40     description: Fluentd logging configuration for mongodb.
41     default:
42       tag: database.mongodb
43       path: /var/log/mongodb/mongodb.log
44       format: >-
45         /(?<time>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d+\+\d{4})
46         (?<message>.*)$/
47   EnableInternalTLS:
48     type: boolean
49     default: false
50
51 conditions:
52
53   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
54
55 resources:
56   MongoDbBase:
57     type: ./mongodb-base.yaml
58     properties:
59       ServiceData: {get_param: ServiceData}
60       ServiceNetMap: {get_param: ServiceNetMap}
61       DefaultPasswords: {get_param: DefaultPasswords}
62       EndpointMap: {get_param: EndpointMap}
63       RoleName: {get_param: RoleName}
64       RoleParameters: {get_param: RoleParameters}
65
66 outputs:
67   role_data:
68     description: Service mongodb using composable services.
69     value:
70       service_name: mongodb
71       logging_groups:
72         - mongodb
73       logging_source: {get_param: MongoDbLoggingSource}
74       config_settings:
75         map_merge:
76           - get_attr: [MongoDbBase, role_data, config_settings]
77           - tripleo::profile::base::database::mongodb::mongodb_replset: {get_attr: [MongoDbBase, aux_parameters, rplset_name]}
78             tripleo::profile::base::database::mongodb::memory_limit: {get_param: MongodbMemoryLimit}
79             mongodb::server::service_manage: True
80             tripleo.mongodb.firewall_rules:
81               '101 mongodb_config':
82                 dport: 27019
83               '102 mongodb_sharding':
84                 dport: 27018
85               '103 mongod':
86                 dport: 27017
87             # NOTE: bind IP is found in Heat replacing the network name with the
88             # local node IP for the given network; replacement examples
89             # (eg. for internal_api):
90             # internal_api -> IP
91             # internal_api_uri -> [IP]
92             # internal_api_subnet - > IP/CIDR
93             mongodb::server::bind_ip: {get_param: [ServiceNetMap, MongodbNetwork]}
94           -
95             if:
96               - internal_tls_enabled
97               -
98                 generate_service_certificates: true
99                 mongodb::server::ssl: true
100                 mongodb::server::ssl_key: '/etc/pki/tls/certs/mongodb.pem'
101                 mongodb_certificate_specs:
102                   service_pem: '/etc/pki/tls/certs/mongodb.pem'
103                   service_certificate: '/etc/pki/tls/certs/mongodb.crt'
104                   service_key: '/etc/pki/tls/private/mongodb.key'
105                   hostname:
106                     str_replace:
107                       template: "%{hiera('fqdn_NETWORK')}"
108                       params:
109                         NETWORK: {get_param: [ServiceNetMap, MongodbNetwork]}
110                   principal:
111                     str_replace:
112                       template: "mongodb/%{hiera('fqdn_NETWORK')}"
113                       params:
114                         NETWORK: {get_param: [ServiceNetMap, MongodbNetwork]}
115               - {}
116       step_config: |
117         include ::tripleo::profile::base::database::mongodb
118       upgrade_tasks:
119         - name: Stop mongodb service
120           tags: step2
121           service: name=mongod state=stopped
122         - name: Start mongodb service
123           tags: step4
124           service: name=mongod state=started
125       metadata_settings:
126         if:
127           - internal_tls_enabled
128           -
129             - service: mongodb
130               network: {get_param: [ServiceNetMap, MongodbNetwork]}
131               type: node
132           - null