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