CI/scenarios: set NotificationDriver to 'noop'
[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   DockerMongodbConfigImage:
16     description: The container image to use for the mongodb config_volume
17     default: 'centos-binary-mongodb:latest'
18     type: string
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   ServiceNetMap:
25     default: {}
26     description: Mapping of service_name -> network name. Typically set
27                  via parameter_defaults in the resource registry.  This
28                  mapping overrides those in ServiceNetMapDefaults.
29     type: json
30   DefaultPasswords:
31     default: {}
32     type: json
33   RoleName:
34     default: ''
35     description: Role name on which the service is applied
36     type: string
37   RoleParameters:
38     default: {}
39     description: Parameters specific to the role
40     type: json
41
42 resources:
43
44   MongodbPuppetBase:
45     type: ../../../puppet/services/database/mongodb.yaml
46     properties:
47       EndpointMap: {get_param: EndpointMap}
48       ServiceNetMap: {get_param: ServiceNetMap}
49       DefaultPasswords: {get_param: DefaultPasswords}
50       RoleName: {get_param: RoleName}
51       RoleParameters: {get_param: RoleParameters}
52
53 outputs:
54   role_data:
55     description: Containerized service Mongodb using composable services.
56     value:
57       service_name: {get_attr: [MongodbPuppetBase, role_data, service_name]}
58       config_settings:
59         map_merge:
60           - get_attr: [MongodbPuppetBase, role_data, config_settings]
61           - mongodb::server::fork: false
62       step_config: &step_config
63         list_join:
64           - "\n"
65           - - "['Mongodb_database', 'Mongodb_user', 'Mongodb_replset'].each |String $val| { noop_resource($val) }"
66             - {get_attr: [MongodbPuppetBase, role_data, step_config]}
67       # BEGIN DOCKER SETTINGS #
68       puppet_config:
69         config_volume: mongodb
70         puppet_tags: file # set this even though file is the default
71         step_config: *step_config
72         config_image: &mongodb_config_image
73           list_join:
74             - '/'
75             - [ {get_param: DockerNamespace}, {get_param: DockerMongodbConfigImage} ]
76       kolla_config:
77         /var/lib/kolla/config_files/mongodb.json:
78           command: /usr/bin/mongod --unixSocketPrefix=/var/run/mongodb --config /etc/mongod.conf run
79           config_files:
80             - source: "/var/lib/kolla/config_files/src/*"
81               dest: "/"
82               merge: true
83               preserve_properties: true
84           permissions:
85             - path: /var/lib/mongodb
86               owner: mongodb:mongodb
87               recurse: true
88             - path: /var/log/mongodb
89               owner: mongodb:mongodb
90               recurse: true
91       docker_config:
92         step_2:
93           mongodb:
94             image:
95               list_join:
96                 - '/'
97                 - [ {get_param: DockerNamespace}, {get_param: DockerMongodbImage} ]
98             net: host
99             privileged: false
100             volumes: &mongodb_volumes
101               - /var/lib/kolla/config_files/mongodb.json:/var/lib/kolla/config_files/config.json
102               - /var/lib/config-data/puppet-generated/mongodb/:/var/lib/kolla/config_files/src:ro
103               - /etc/localtime:/etc/localtime:ro
104               - /var/log/containers/mongodb:/var/log/mongodb
105               - /var/lib/mongodb:/var/lib/mongodb
106             environment:
107               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
108       docker_puppet_tasks:
109         # MySQL database initialization occurs only on single node
110         step_2:
111           config_volume: 'mongodb_init_tasks'
112           puppet_tags: 'mongodb_database,mongodb_user,mongodb_replset'
113           step_config: 'include ::tripleo::profile::base::database::mongodb'
114           config_image: *mongodb_config_image
115           volumes:
116             - /var/lib/mongodb:/var/lib/mongodb
117             - /var/log/containers/mongodb:/var/log/mongodb
118       host_prep_tasks:
119         - name: create persistent directories
120           file:
121             path: "{{ item }}"
122             state: directory
123           with_items:
124             - /var/log/containers/mongodb
125             - /var/lib/mongodb
126       upgrade_tasks:
127         - name: Stop and disable mongodb service
128           tags: step2
129           service: name=mongod state=stopped enabled=no