Merge "Use a single configuration file for specifying docker containers."
[apex-tripleo-heat-templates.git] / docker / services / manila-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Manila API service
5
6 parameters:
7   DockerManilaApiImage:
8     description: image
9     type: string
10   DockerManilaConfigImage:
11     description: The container image to use for the manila config_volume
12     type: string
13   EndpointMap:
14     default: {}
15     description: Mapping of service endpoint -> protocol. Typically set
16                  via parameter_defaults in the resource registry.
17     type: json
18   ServiceData:
19     default: {}
20     description: Dictionary packing service data
21     type: json
22   ServiceNetMap:
23     default: {}
24     description: Mapping of service_name -> network name. Typically set
25                  via parameter_defaults in the resource registry.  This
26                  mapping overrides those in ServiceNetMapDefaults.
27     type: json
28   DefaultPasswords:
29     default: {}
30     type: json
31   RoleName:
32     default: ''
33     description: Role name on which the service is applied
34     type: string
35   RoleParameters:
36     default: {}
37     description: Parameters specific to the role
38     type: json
39
40 resources:
41
42   ContainersCommon:
43     type: ./containers-common.yaml
44
45   ManilaApiPuppetBase:
46     type: ../../puppet/services/manila-api.yaml
47     properties:
48       EndpointMap: {get_param: EndpointMap}
49       ServiceData: {get_param: ServiceData}
50       ServiceNetMap: {get_param: ServiceNetMap}
51       DefaultPasswords: {get_param: DefaultPasswords}
52
53 outputs:
54   role_data:
55     description: Role data for the Manila API role.
56     value:
57       service_name: {get_attr: [ManilaApiPuppetBase, role_data, service_name]}
58       config_settings: {get_attr: [ManilaApiPuppetBase, role_data, config_settings]}
59       step_config: &step_config
60         {get_attr: [ManilaApiPuppetBase, role_data, step_config]}
61       service_config_settings: {get_attr: [ManilaApiPuppetBase, role_data, service_config_settings]}
62       # BEGIN DOCKER SETTINGS #
63       puppet_config:
64         config_volume: manila
65         puppet_tags: manila_config,manila_api_paste_ini
66         step_config: *step_config
67         config_image: {get_param: DockerManilaConfigImage}
68       kolla_config:
69         /var/lib/kolla/config_files/manila_api.json:
70           command: /usr/bin/manila-api --config-file /usr/share/manila/manila-dist.conf --config-file /etc/manila/manila.conf
71           config_files:
72             - source: "/var/lib/kolla/config_files/src/*"
73               dest: "/"
74               merge: true
75               preserve_properties: true
76           permissions:
77             - path: /var/log/manila
78               owner: manila:manila
79               recurse: true
80       docker_config:
81         step_2:
82           manila_init_logs:
83             image: &manila_api_image {get_param: DockerManilaApiImage}
84             user: root
85             volumes:
86               - /var/log/containers/manila:/var/log/manila
87             command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd; chown -R manila:manila /var/log/manila']
88         step_3:
89           manila_api_db_sync:
90             user: root
91             image: *manila_api_image
92             net: host
93             detach: false
94             volumes:
95               list_concat:
96                 - {get_attr: [ContainersCommon, volumes]}
97                 -
98                   - /var/lib/config-data/manila/etc/manila/:/etc/manila/:ro
99                   - /var/log/containers/manila:/var/log/manila
100             command: "/usr/bin/bootstrap_host_exec manila_api su manila -s /bin/bash -c '/usr/bin/manila-manage db sync'"
101         step_4:
102           manila_api:
103             image: *manila_api_image
104             net: host
105             restart: always
106             volumes:
107               list_concat:
108                 - {get_attr: [ContainersCommon, volumes]}
109                 -
110                   - /var/lib/kolla/config_files/manila_api.json:/var/lib/kolla/config_files/config.json:ro
111                   - /var/lib/config-data/puppet-generated/manila/:/var/lib/kolla/config_files/src:ro
112                   - /var/log/containers/manila:/var/log/manila
113             environment:
114               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
115       host_prep_tasks:
116         - name: Create persistent manila logs directory
117           file:
118             path: /var/log/containers/manila
119             state: directory
120       upgrade_tasks:
121         - name: Stop and disable manila_api service
122           tags: step2
123           service: name=openstack-manila-api state=stopped enabled=no