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