containers: TLS in the internal network for telemetry services
[apex-tripleo-heat-templates.git] / docker / services / aodh-api.yaml
1 heat_template_version: ocata
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   EnableInternalTLS:
30     type: boolean
31     default: false
32
33 conditions:
34
35   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
36
37 resources:
38
39   ContainersCommon:
40     type: ./containers-common.yaml
41
42   AodhApiPuppetBase:
43       type: ../../puppet/services/aodh-api.yaml
44       properties:
45         EndpointMap: {get_param: EndpointMap}
46         ServiceNetMap: {get_param: ServiceNetMap}
47         DefaultPasswords: {get_param: DefaultPasswords}
48
49 outputs:
50   role_data:
51     description: Role data for the aodh API role.
52     value:
53       service_name: {get_attr: [AodhApiPuppetBase, role_data, service_name]}
54       config_settings:
55         map_merge:
56           - get_attr: [AodhApiPuppetBase, role_data, config_settings]
57           - apache::default_vhost: false
58       step_config: &step_config
59         get_attr: [AodhApiPuppetBase, role_data, step_config]
60       service_config_settings: {get_attr: [AodhApiPuppetBase, role_data, service_config_settings]}
61       # BEGIN DOCKER SETTINGS
62       puppet_config:
63         config_volume: aodh
64         puppet_tags: aodh_api_paste_ini,aodh_config
65         step_config: *step_config
66         config_image: &aodh_image
67           list_join:
68             - '/'
69             - [ {get_param: DockerNamespace}, {get_param: DockerAodhApiImage} ]
70       kolla_config:
71         /var/lib/kolla/config_files/aodh-api.json:
72           command: /usr/sbin/httpd -DFOREGROUND
73       docker_config:
74         step_3:
75           aodh_init_log:
76             start_order: 0
77             image: *aodh_image
78             user: root
79             command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd && mkdir -p /var/log/aodh && chown aodh:aodh /var/log/aodh']
80             volumes:
81               - logs:/var/log
82           aodh_db_sync:
83             start_order: 1
84             image: *aodh_image
85             net: host
86             privileged: false
87             detach: false
88             volumes:
89               yaql:
90                 expression: $.data.common.concat($.data.service)
91                 data:
92                   common: {get_attr: [ContainersCommon, volumes]}
93                   service:
94                     - /var/lib/config-data/aodh/etc/aodh/:/etc/aodh/:ro
95                     - logs:/var/log
96             command: /usr/bin/aodh-dbsync
97         step_4:
98           aodh_api:
99             image: *aodh_image
100             net: host
101             privileged: false
102             restart: always
103             volumes:
104               yaql:
105                 expression: $.data.common.concat($.data.service)
106                 data:
107                   common: {get_attr: [ContainersCommon, volumes]}
108                   service:
109                     - /var/lib/kolla/config_files/aodh-api.json:/var/lib/kolla/config_files/config.json:ro
110                     - /var/lib/config-data/aodh/etc/aodh/:/etc/aodh/:ro
111                     - /var/lib/config-data/aodh/etc/httpd/:/etc/httpd/:ro
112                     - /var/lib/config-data/aodh/var/www/:/var/www/:ro
113                     - logs:/var/log
114                     -
115                       if:
116                         - internal_tls_enabled
117                         - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
118                         - ''
119                     -
120                       if:
121                         - internal_tls_enabled
122                         - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
123                         - ''
124             environment:
125               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
126       upgrade_tasks:
127         - name: Stop and disable aodh service (running under httpd)
128           tags: step2
129           service: name=httpd state=stopped enabled=no
130       metadata_settings:
131         get_attr: [AodhApiPuppetBase, role_data, metadata_settings]