Enable TLS for nova api and placement containers
[apex-tripleo-heat-templates.git] / docker / services / nova-placement.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Nova Placement API service
5
6 parameters:
7   DockerNovaPlacementImage:
8     description: image
9     type: string
10   DockerNovaPlacementConfigImage:
11     description: The container image to use for the nova_placement 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   MySQLClient:
53     type: ../../puppet/services/database/mysql-client.yaml
54
55   NovaPlacementBase:
56     type: ../../puppet/services/nova-placement.yaml
57     properties:
58       EndpointMap: {get_param: EndpointMap}
59       ServiceData: {get_param: ServiceData}
60       ServiceNetMap: {get_param: ServiceNetMap}
61       DefaultPasswords: {get_param: DefaultPasswords}
62       RoleName: {get_param: RoleName}
63       RoleParameters: {get_param: RoleParameters}
64
65 outputs:
66   role_data:
67     description: Role data for the Nova Placement API role.
68     value:
69       service_name: {get_attr: [NovaPlacementBase, role_data, service_name]}
70       config_settings:
71         map_merge:
72           - get_attr: [NovaPlacementBase, role_data, config_settings]
73           - apache::default_vhost: false
74       step_config: &step_config
75         list_join:
76           - "\n"
77           - - {get_attr: [NovaPlacementBase, role_data, step_config]}
78             - {get_attr: [MySQLClient, role_data, step_config]}
79       service_config_settings: {get_attr: [NovaPlacementBase, role_data, service_config_settings]}
80       # BEGIN DOCKER SETTINGS
81       puppet_config:
82         config_volume: nova_placement
83         puppet_tags: nova_config
84         step_config: *step_config
85         config_image: {get_param: DockerNovaPlacementConfigImage}
86       kolla_config:
87         /var/lib/kolla/config_files/nova_placement.json:
88           command: /usr/sbin/httpd -DFOREGROUND
89           config_files:
90             - source: "/var/lib/kolla/config_files/src/*"
91               dest: "/"
92               merge: true
93               preserve_properties: true
94           permissions:
95             - path: /var/log/nova
96               owner: nova:nova
97               recurse: true
98       docker_config:
99         # start this early so it is up before computes start reporting
100         step_3:
101           nova_placement:
102             start_order: 1
103             image: {get_param: DockerNovaPlacementImage}
104             net: host
105             user: root
106             restart: always
107             volumes:
108               list_concat:
109                 - {get_attr: [ContainersCommon, volumes]}
110                 -
111                   - /var/lib/kolla/config_files/nova_placement.json:/var/lib/kolla/config_files/config.json:ro
112                   - /var/lib/config-data/puppet-generated/nova_placement/:/var/lib/kolla/config_files/src:ro
113                   - /var/log/containers/nova:/var/log/nova
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       metadata_settings:
127         get_attr: [NovaPlacementBase, role_data, metadata_settings]
128       host_prep_tasks:
129         - name: create persistent logs directory
130           file:
131             path: /var/log/containers/nova
132             state: directory
133       upgrade_tasks:
134         - name: Stop and disable nova_placement service (running under httpd)
135           tags: step2
136           service: name=httpd state=stopped enabled=no