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