Adds network/cidr mapping into a new service property
[apex-tripleo-heat-templates.git] / docker / services / gnocchi-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized gnocchi service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerGnocchiApiImage:
12     description: image
13     default: 'centos-binary-gnocchi-api:latest'
14     type: string
15   DockerGnocchiConfigImage:
16     description: The container image to use for the gnocchi config_volume
17     default: 'centos-binary-gnocchi-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   ServiceData:
25     default: {}
26     description: Dictionary packing service data
27     type: json
28   ServiceNetMap:
29     default: {}
30     description: Mapping of service_name -> network name. Typically set
31                  via parameter_defaults in the resource registry.  This
32                  mapping overrides those in ServiceNetMapDefaults.
33     type: json
34   DefaultPasswords:
35     default: {}
36     type: json
37   RoleName:
38     default: ''
39     description: Role name on which the service is applied
40     type: string
41   RoleParameters:
42     default: {}
43     description: Parameters specific to the role
44     type: json
45   EnableInternalTLS:
46     type: boolean
47     default: false
48
49 conditions:
50
51   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
52
53 resources:
54
55   ContainersCommon:
56     type: ./containers-common.yaml
57
58   GnocchiApiPuppetBase:
59       type: ../../puppet/services/gnocchi-api.yaml
60       properties:
61         EndpointMap: {get_param: EndpointMap}
62         ServiceNetMap: {get_param: ServiceNetMap}
63         DefaultPasswords: {get_param: DefaultPasswords}
64         RoleName: {get_param: RoleName}
65         RoleParameters: {get_param: RoleParameters}
66
67 outputs:
68   role_data:
69     description: Role data for the gnocchi API role.
70     value:
71       service_name: {get_attr: [GnocchiApiPuppetBase, role_data, service_name]}
72       config_settings:
73         map_merge:
74           - get_attr: [GnocchiApiPuppetBase, role_data, config_settings]
75           - apache::default_vhost: false
76       step_config: &step_config
77         get_attr: [GnocchiApiPuppetBase, role_data, step_config]
78       service_config_settings: {get_attr: [GnocchiApiPuppetBase, role_data, service_config_settings]}
79       # BEGIN DOCKER SETTINGS
80       puppet_config:
81         config_volume: gnocchi
82         puppet_tags: gnocchi_api_paste_ini,gnocchi_config
83         step_config: *step_config
84         config_image:
85           list_join:
86             - '/'
87             - [ {get_param: DockerNamespace}, {get_param: DockerGnocchiConfigImage} ]
88       kolla_config:
89         /var/lib/kolla/config_files/gnocchi_api.json:
90           command: /usr/sbin/httpd -DFOREGROUND
91           config_files:
92             - source: "/var/lib/kolla/config_files/src/*"
93               dest: "/"
94               merge: true
95               preserve_properties: true
96           permissions:
97             - path: /var/log/gnocchi
98               owner: gnocchi:gnocchi
99               recurse: true
100       docker_config:
101         # db sync runs before permissions set by kolla_config
102         step_2:
103           gnocchi_init_log:
104             image: &gnocchi_api_image
105               list_join:
106                 - '/'
107                 - [ {get_param: DockerNamespace}, {get_param: DockerGnocchiApiImage} ]
108             user: root
109             volumes:
110               - /var/log/containers/gnocchi:/var/log/gnocchi
111             command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd; chown -R gnocchi:gnocchi /var/log/gnocchi']
112         step_3:
113           gnocchi_db_sync:
114             image: *gnocchi_api_image
115             net: host
116             detach: false
117             privileged: false
118             user: root
119             volumes:
120               list_concat:
121                 - {get_attr: [ContainersCommon, volumes]}
122                 -
123                   - /var/lib/config-data/gnocchi/etc/gnocchi/:/etc/gnocchi/:ro
124                   - /var/log/containers/gnocchi:/var/log/gnocchi
125             command: "/usr/bin/bootstrap_host_exec gnocchi_api su gnocchi -s /bin/bash -c '/usr/bin/gnocchi-upgrade --skip-storage'"
126         step_4:
127           gnocchi_api:
128             image: *gnocchi_api_image
129             net: host
130             privileged: false
131             restart: always
132             volumes:
133               list_concat:
134                 - {get_attr: [ContainersCommon, volumes]}
135                 -
136                   - /var/lib/kolla/config_files/gnocchi_api.json:/var/lib/kolla/config_files/config.json:ro
137                   - /var/lib/config-data/puppet-generated/gnocchi/:/var/lib/kolla/config_files/src:ro
138                   - /var/log/containers/gnocchi:/var/log/gnocchi
139                   -
140                     if:
141                       - internal_tls_enabled
142                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
143                       - ''
144                   -
145                     if:
146                       - internal_tls_enabled
147                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
148                       - ''
149             environment:
150               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
151       host_prep_tasks:
152         - name: create persistent logs directory
153           file:
154             path: /var/log/containers/gnocchi
155             state: directory
156       upgrade_tasks:
157         - name: Stop and disable httpd service
158           tags: step2
159           service: name=httpd state=stopped enabled=no
160       metadata_settings:
161         get_attr: [GnocchiApiPuppetBase, role_data, metadata_settings]