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