Merge "Only set apache certificates if TLS everywhere is enabled"
[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
43 resources:
44
45   ContainersCommon:
46     type: ./containers-common.yaml
47
48   NeutronBase:
49     type: ../../puppet/services/neutron-api.yaml
50     properties:
51       EndpointMap: {get_param: EndpointMap}
52       ServiceNetMap: {get_param: ServiceNetMap}
53       DefaultPasswords: {get_param: DefaultPasswords}
54       RoleName: {get_param: RoleName}
55       RoleParameters: {get_param: RoleParameters}
56
57 outputs:
58   role_data:
59     description: Role data for the Neutron API role.
60     value:
61       service_name: {get_attr: [NeutronBase, role_data, service_name]}
62       config_settings:
63         map_merge:
64           - get_attr: [NeutronBase, role_data, config_settings]
65       step_config: &step_config
66         get_attr: [NeutronBase, role_data, step_config]
67       service_config_settings: {get_attr: [NeutronBase, role_data, service_config_settings]}
68       # BEGIN DOCKER SETTINGS
69       puppet_config:
70         config_volume: neutron
71         puppet_tags: neutron_config,neutron_api_config
72         step_config: *step_config
73         config_image:
74           list_join:
75             - '/'
76             - [ {get_param: DockerNamespace}, {get_param: DockerNeutronConfigImage} ]
77       kolla_config:
78         /var/lib/kolla/config_files/neutron_api.json:
79           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
80           permissions:
81             - path: /var/log/neutron
82               owner: neutron:neutron
83               recurse: true
84       docker_config:
85         # db sync runs before permissions set by kolla_config
86         step_3:
87           neutron_init_logs:
88             start_order: 0
89             image: &neutron_api_image
90               list_join:
91                 - '/'
92                 - [ {get_param: DockerNamespace}, {get_param: DockerNeutronApiImage} ]
93             privileged: false
94             user: root
95             volumes:
96               - /var/log/containers/neutron:/var/log/neutron
97             command: ['/bin/bash', '-c', 'chown -R neutron:neutron /var/log/neutron']
98           neutron_db_sync:
99             start_order: 1
100             image: *neutron_api_image
101             net: host
102             privileged: false
103             detach: false
104             # FIXME: we should make config file permissions right
105             # and run as neutron user
106             user: root
107             volumes:
108               list_concat:
109                 - {get_attr: [ContainersCommon, volumes]}
110                 -
111                   - /var/lib/config-data/neutron/etc/neutron:/etc/neutron:ro
112                   - /var/lib/config-data/neutron/usr/share/neutron:/usr/share/neutron:ro
113                   - /var/log/containers/neutron:/var/log/neutron
114             command: ['neutron-db-manage', 'upgrade', 'heads']
115         step_4:
116           neutron_api:
117             image: *neutron_api_image
118             net: host
119             privileged: false
120             restart: always
121             volumes:
122               list_concat:
123                 - {get_attr: [ContainersCommon, volumes]}
124                 -
125                   - /var/lib/kolla/config_files/neutron_api.json:/var/lib/kolla/config_files/config.json:ro
126                   - /var/lib/config-data/neutron/etc/neutron/:/etc/neutron/:ro
127                   - /var/log/containers/neutron:/var/log/neutron
128             environment:
129               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
130       host_prep_tasks:
131         - name: create persistent logs directory
132           file:
133             path: /var/log/containers/neutron
134             state: directory
135       upgrade_tasks:
136         - name: Stop and disable neutron_api service
137           tags: step2
138           service: name=neutron-server state=stopped enabled=no