Merge "Use a single configuration file for specifying docker containers."
[apex-tripleo-heat-templates.git] / docker / services / aodh-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized aodh service
5
6 parameters:
7   DockerAodhApiImage:
8     description: image
9     type: string
10   DockerAodhConfigImage:
11     description: The container image to use for the aodh 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   EnableInternalTLS:
40     type: boolean
41     default: false
42
43 conditions:
44
45   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
46
47 resources:
48
49   ContainersCommon:
50     type: ./containers-common.yaml
51
52   AodhApiPuppetBase:
53       type: ../../puppet/services/aodh-api.yaml
54       properties:
55         EndpointMap: {get_param: EndpointMap}
56         ServiceNetMap: {get_param: ServiceNetMap}
57         DefaultPasswords: {get_param: DefaultPasswords}
58         RoleName: {get_param: RoleName}
59         RoleParameters: {get_param: RoleParameters}
60
61 outputs:
62   role_data:
63     description: Role data for the aodh API role.
64     value:
65       service_name: {get_attr: [AodhApiPuppetBase, role_data, service_name]}
66       config_settings:
67         map_merge:
68           - get_attr: [AodhApiPuppetBase, role_data, config_settings]
69           - apache::default_vhost: false
70       step_config: &step_config
71         get_attr: [AodhApiPuppetBase, role_data, step_config]
72       service_config_settings: {get_attr: [AodhApiPuppetBase, role_data, service_config_settings]}
73       # BEGIN DOCKER SETTINGS
74       puppet_config:
75         config_volume: aodh
76         puppet_tags: aodh_api_paste_ini,aodh_config
77         step_config: *step_config
78         config_image: {get_param: DockerAodhConfigImage}
79       kolla_config:
80         /var/lib/kolla/config_files/aodh_api.json:
81           command: /usr/sbin/httpd -DFOREGROUND
82           config_files:
83             - source: "/var/lib/kolla/config_files/src/*"
84               dest: "/"
85               merge: true
86               preserve_properties: true
87           permissions:
88             - path: /var/log/aodh
89               owner: aodh:aodh
90               recurse: true
91       docker_config:
92         # db sync runs before permissions set by kolla_config
93         step_2:
94           aodh_init_log:
95             image: &aodh_api_image {get_param: DockerAodhApiImage}
96             user: root
97             volumes:
98               - /var/log/containers/aodh:/var/log/aodh
99             command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd; chown -R aodh:aodh /var/log/aodh']
100         step_3:
101           aodh_db_sync:
102             image: *aodh_api_image
103             net: host
104             privileged: false
105             detach: false
106             user: root
107             volumes:
108               list_concat:
109                 - {get_attr: [ContainersCommon, volumes]}
110                 -
111                   - /var/lib/config-data/aodh/etc/aodh/:/etc/aodh/:ro
112                   - /var/log/containers/aodh:/var/log/aodh
113             command: "/usr/bin/bootstrap_host_exec aodh_api su aodh -s /bin/bash -c /usr/bin/aodh-dbsync"
114         step_4:
115           aodh_api:
116             image: *aodh_api_image
117             net: host
118             privileged: false
119             restart: always
120             volumes:
121               list_concat:
122                 - {get_attr: [ContainersCommon, volumes]}
123                 -
124                   - /var/lib/kolla/config_files/aodh_api.json:/var/lib/kolla/config_files/config.json:ro
125                   - /var/lib/config-data/puppet-generated/aodh/:/var/lib/kolla/config_files/src:ro
126                   - /var/log/containers/aodh:/var/log/aodh
127                   -
128                     if:
129                       - internal_tls_enabled
130                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
131                       - ''
132                   -
133                     if:
134                       - internal_tls_enabled
135                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
136                       - ''
137             environment:
138               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
139       host_prep_tasks:
140       - name: create persistent logs directory
141         file:
142           path: /var/log/containers/aodh
143           state: directory
144       upgrade_tasks:
145         - name: Stop and disable aodh service (running under httpd)
146           tags: step2
147           service: name=httpd state=stopped enabled=no
148       metadata_settings:
149         get_attr: [AodhApiPuppetBase, role_data, metadata_settings]