Merge "Enable splay for os-collect-config"
[apex-tripleo-heat-templates.git] / docker / services / neutron-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Neutron API service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerNeutronApiImage:
12     description: image
13     default: 'centos-binary-neutron-server:latest'
14     type: string
15   # we configure all neutron services in the same neutron
16   DockerNeutronConfigImage:
17     description: image
18     default: 'centos-binary-neutron-server:latest'
19     type: string
20   EndpointMap:
21     default: {}
22     description: Mapping of service endpoint -> protocol. Typically set
23                  via parameter_defaults in the resource registry.
24     type: json
25   ServiceNetMap:
26     default: {}
27     description: Mapping of service_name -> network name. Typically set
28                  via parameter_defaults in the resource registry.  This
29                  mapping overrides those in ServiceNetMapDefaults.
30     type: json
31   DefaultPasswords:
32     default: {}
33     type: json
34   RoleName:
35     default: ''
36     description: Role name on which the service is applied
37     type: string
38   RoleParameters:
39     default: {}
40     description: Parameters specific to the role
41     type: json
42   EnableInternalTLS:
43     type: boolean
44     default: false
45
46 conditions:
47
48   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
49
50 resources:
51
52   ContainersCommon:
53     type: ./containers-common.yaml
54
55   NeutronBase:
56     type: ../../puppet/services/neutron-api.yaml
57     properties:
58       EndpointMap: {get_param: EndpointMap}
59       ServiceNetMap: {get_param: ServiceNetMap}
60       DefaultPasswords: {get_param: DefaultPasswords}
61       RoleName: {get_param: RoleName}
62       RoleParameters: {get_param: RoleParameters}
63
64 outputs:
65   role_data:
66     description: Role data for the Neutron API role.
67     value:
68       service_name: {get_attr: [NeutronBase, role_data, service_name]}
69       config_settings:
70         map_merge:
71           - get_attr: [NeutronBase, role_data, config_settings]
72       step_config: &step_config
73         get_attr: [NeutronBase, role_data, step_config]
74       service_config_settings: {get_attr: [NeutronBase, role_data, service_config_settings]}
75       # BEGIN DOCKER SETTINGS
76       puppet_config:
77         config_volume: neutron
78         puppet_tags: neutron_config,neutron_api_config
79         step_config: *step_config
80         config_image:
81           list_join:
82             - '/'
83             - [ {get_param: DockerNamespace}, {get_param: DockerNeutronConfigImage} ]
84       kolla_config:
85         /var/lib/kolla/config_files/neutron_api.json:
86           command: /usr/bin/neutron-server --config-file /usr/share/neutron/neutron-dist.conf --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini
87           permissions:
88             - path: /var/log/neutron
89               owner: neutron:neutron
90               recurse: true
91         /var/lib/kolla/config_files/neutron_server_tls_proxy.json:
92           command: /usr/sbin/httpd -DFOREGROUND
93       docker_config:
94         # db sync runs before permissions set by kolla_config
95         step_3:
96           neutron_init_logs:
97             start_order: 0
98             image: &neutron_api_image
99               list_join:
100                 - '/'
101                 - [ {get_param: DockerNamespace}, {get_param: DockerNeutronApiImage} ]
102             privileged: false
103             user: root
104             volumes:
105               - /var/log/containers/neutron:/var/log/neutron
106             command: ['/bin/bash', '-c', 'chown -R neutron:neutron /var/log/neutron']
107           neutron_db_sync:
108             start_order: 1
109             image: *neutron_api_image
110             net: host
111             privileged: false
112             detach: false
113             # FIXME: we should make config file permissions right
114             # and run as neutron user
115             user: root
116             volumes:
117               list_concat:
118                 - {get_attr: [ContainersCommon, volumes]}
119                 -
120                   - /var/lib/config-data/neutron/etc/neutron:/etc/neutron:ro
121                   - /var/lib/config-data/neutron/usr/share/neutron:/usr/share/neutron:ro
122                   - /var/log/containers/neutron:/var/log/neutron
123             command: ['neutron-db-manage', 'upgrade', 'heads']
124         step_4:
125           map_merge:
126             - neutron_api:
127                 image: *neutron_api_image
128                 net: host
129                 privileged: false
130                 restart: always
131                 volumes:
132                   list_concat:
133                     - {get_attr: [ContainersCommon, volumes]}
134                     -
135                       - /var/lib/kolla/config_files/neutron_api.json:/var/lib/kolla/config_files/config.json:ro
136                       - /var/lib/config-data/neutron/etc/neutron/:/etc/neutron/:ro
137                       - /var/log/containers/neutron:/var/log/neutron
138                 environment:
139                   - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
140             - if:
141                 - internal_tls_enabled
142                 - neutron_server_tls_proxy:
143                     image: *neutron_api_image
144                     net: host
145                     user: root
146                     restart: always
147                     volumes:
148                       list_concat:
149                         - {get_attr: [ContainersCommon, volumes]}
150                         -
151                           - /var/lib/kolla/config_files/neutron_server_tls_proxy.json:/var/lib/kolla/config_files/config.json:ro
152                           - /var/lib/config-data/neutron/etc/httpd/:/etc/httpd/:ro
153                           - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
154                           - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
155                     environment:
156                       - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
157                 - {}
158       host_prep_tasks:
159         - name: create persistent logs directory
160           file:
161             path: /var/log/containers/neutron
162             state: directory
163       upgrade_tasks:
164         - name: Stop and disable neutron_api service
165           tags: step2
166           service: name=neutron-server state=stopped enabled=no