Update the template_version alias for all the templates to pike.
[apex-tripleo-heat-templates.git] / docker / services / database / mongodb.yaml
1 heat_template_version: pike
2
3 description: >
4   MongoDB service deployment using puppet and docker
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerMongodbImage:
12     description: image
13     default: 'centos-binary-mongodb:latest'
14     type: string
15   EndpointMap:
16     default: {}
17     description: Mapping of service endpoint -> protocol. Typically set
18                  via parameter_defaults in the resource registry.
19     type: json
20   ServiceNetMap:
21     default: {}
22     description: Mapping of service_name -> network name. Typically set
23                  via parameter_defaults in the resource registry.  This
24                  mapping overrides those in ServiceNetMapDefaults.
25     type: json
26   DefaultPasswords:
27     default: {}
28     type: json
29   RoleName:
30     default: ''
31     description: Role name on which the service is applied
32     type: string
33   RoleParameters:
34     default: {}
35     description: Parameters specific to the role
36     type: json
37
38 resources:
39
40   MongodbPuppetBase:
41     type: ../../../puppet/services/database/mongodb.yaml
42     properties:
43       EndpointMap: {get_param: EndpointMap}
44       ServiceNetMap: {get_param: ServiceNetMap}
45       DefaultPasswords: {get_param: DefaultPasswords}
46       RoleName: {get_param: RoleName}
47       RoleParameters: {get_param: RoleParameters}
48
49 outputs:
50   role_data:
51     description: Containerized service Mongodb using composable services.
52     value:
53       service_name: {get_attr: [MongodbPuppetBase, role_data, service_name]}
54       config_settings:
55         map_merge:
56           - get_attr: [MongodbPuppetBase, role_data, config_settings]
57           - mongodb::server::fork: false
58       step_config: &step_config
59         list_join:
60           - "\n"
61           - - "['Mongodb_database', 'Mongodb_user', 'Mongodb_replset'].each |String $val| { noop_resource($val) }"
62             - {get_attr: [MongodbPuppetBase, role_data, step_config]}
63       # BEGIN DOCKER SETTINGS #
64       puppet_config:
65         config_volume: mongodb
66         puppet_tags: file # set this even though file is the default
67         step_config: *step_config
68         config_image: &mongodb_image
69           list_join:
70             - '/'
71             - [ {get_param: DockerNamespace}, {get_param: DockerMongodbImage} ]
72       kolla_config:
73         /var/lib/kolla/config_files/mongodb.json:
74           command: /usr/bin/mongod --unixSocketPrefix=/var/run/mongodb --config /etc/mongod.conf run
75           permissions:
76             - path: /var/lib/mongodb
77               owner: mongodb:mongodb
78               recurse: true
79             - path: /var/log/mongodb
80               owner: mongodb:mongodb
81               recurse: true
82       docker_config:
83         step_2:
84           mongodb:
85             image: *mongodb_image
86             net: host
87             privileged: false
88             volumes: &mongodb_volumes
89               - /var/lib/kolla/config_files/mongodb.json:/var/lib/kolla/config_files/config.json
90               - /var/lib/config-data/mongodb/etc/:/etc/:ro
91               - /etc/localtime:/etc/localtime:ro
92               - /var/log/containers/mongodb:/var/log/mongodb
93               - /var/lib/mongodb:/var/lib/mongodb
94             environment:
95               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
96       docker_puppet_tasks:
97         # MySQL database initialization occurs only on single node
98         step_2:
99           config_volume: 'mongodb_init_tasks'
100           puppet_tags: 'mongodb_database,mongodb_user,mongodb_replset'
101           step_config: 'include ::tripleo::profile::base::database::mongodb'
102           config_image: *mongodb_image
103           volumes:
104             - /var/lib/mongodb:/var/lib/mongodb
105             - /var/log/containers/mongodb:/var/log/mongodb
106       host_prep_tasks:
107         - name: create persistent directories
108           file:
109             path: "{{ item }}"
110             state: directory
111           with_items:
112             - /var/log/containers/mongodb
113             - /var/lib/mongodb
114       upgrade_tasks:
115         - name: Stop and disable mongodb service
116           tags: step2
117           service: name=mongod state=stopped enabled=no