Merge "Disable ComputeNeutron* for cisco-nexus-ucsm"
[apex-tripleo-heat-templates.git] / docker / services / nova-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Nova API service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerNovaApiImage:
12     description: image
13     default: 'centos-binary-nova-api:latest'
14     type: string
15   DockerNovaConfigImage:
16     description: image
17     default: 'centos-binary-nova-base:latest'
18     type: string
19   EndpointMap:
20     default: {}
21     description: Mapping of service endpoint -> protocol. Typically set
22                  via parameter_defaults in the resource registry.
23     type: json
24   ServiceNetMap:
25     default: {}
26     description: Mapping of service_name -> network name. Typically set
27                  via parameter_defaults in the resource registry.  This
28                  mapping overrides those in ServiceNetMapDefaults.
29     type: json
30   DefaultPasswords:
31     default: {}
32     type: json
33   RoleName:
34     default: ''
35     description: Role name on which the service is applied
36     type: string
37   RoleParameters:
38     default: {}
39     description: Parameters specific to the role
40
41 resources:
42
43   ContainersCommon:
44     type: ./containers-common.yaml
45
46   NovaApiBase:
47     type: ../../puppet/services/nova-api.yaml
48     properties:
49       EndpointMap: {get_param: EndpointMap}
50       ServiceNetMap: {get_param: ServiceNetMap}
51       DefaultPasswords: {get_param: DefaultPasswords}
52       RoleName: {get_param: RoleName}
53       RoleParameters: {get_param: RoleParameters}
54
55 outputs:
56   role_data:
57     description: Role data for the Nova API role.
58     value:
59       service_name: {get_attr: [NovaApiBase, role_data, service_name]}
60       config_settings:
61         map_merge:
62           - get_attr: [NovaApiBase, role_data, config_settings]
63           - apache::default_vhost: false
64       step_config: &step_config
65         list_join:
66           - "\n"
67           - - "['Nova_cell_v2'].each |String $val| { noop_resource($val) }"
68             - {get_attr: [NovaApiBase, role_data, step_config]}
69       service_config_settings: {get_attr: [NovaApiBase, role_data, service_config_settings]}
70       # BEGIN DOCKER SETTINGS
71       puppet_config:
72         config_volume: nova
73         puppet_tags: nova_config
74         step_config: *step_config
75         config_image:
76           list_join:
77           - '/'
78           - [ {get_param: DockerNamespace}, {get_param: DockerNovaConfigImage} ]
79       kolla_config:
80         /var/lib/kolla/config_files/nova_api.json:
81           command: /usr/bin/nova-api
82           permissions:
83             - path: /var/log/nova
84               owner: nova:nova
85               recurse: true
86       docker_config:
87         # db sync runs before permissions set by kolla_config
88         step_3:
89           nova_init_logs:
90             start_order: 0
91             image: &nova_api_image
92               list_join:
93                 - '/'
94                 - [ {get_param: DockerNamespace}, {get_param: DockerNovaApiImage} ]
95             privileged: false
96             user: root
97             volumes:
98               - /var/log/containers/nova:/var/log/nova
99             command: ['/bin/bash', '-c', 'chown -R nova:nova /var/log/nova']
100           nova_api_db_sync:
101             start_order: 1
102             image: *nova_api_image
103             net: host
104             detach: false
105             volumes: &nova_api_volumes
106               list_concat:
107                 - {get_attr: [ContainersCommon, volumes]}
108                 -
109                   - /var/lib/kolla/config_files/nova_api.json:/var/lib/kolla/config_files/config.json:ro
110                   - /var/lib/config-data/nova/etc/nova/:/etc/nova/:ro
111                   - /var/log/containers/nova:/var/log/nova
112             command: ['/usr/bin/nova-manage', 'api_db', 'sync']
113           # FIXME: we probably want to wait on the 'cell_v2 update' in order for this
114           # to be capable of upgrading a baremetal setup. This is to ensure the name
115           # of the cell is 'default'
116           nova_api_map_cell0:
117             start_order: 2
118             image: *nova_api_image
119             net: host
120             detach: false
121             volumes: *nova_api_volumes
122             command:
123               - '/usr/bin/nova-manage'
124               - 'cell_v2'
125               - 'map_cell0'
126           nova_api_create_default_cell:
127             start_order: 3
128             image: *nova_api_image
129             net: host
130             detach: false
131             volumes: *nova_api_volumes
132             # NOTE: allowing the exit code 2 is a dirty way of making
133             # this idempotent (if the resource already exists a conflict
134             # is raised)
135             exit_codes: [0,2]
136             command:
137               - '/usr/bin/nova-manage'
138               - 'cell_v2'
139               - 'create_cell'
140               - '--name="default"'
141           nova_db_sync:
142             start_order: 4
143             image: *nova_api_image
144             net: host
145             detach: false
146             volumes: *nova_api_volumes
147             command: ['/usr/bin/nova-manage', 'db', 'sync']
148         step_4:
149           nova_api:
150             start_order: 2
151             image: *nova_api_image
152             net: host
153             user: nova
154             privileged: true
155             restart: always
156             volumes: *nova_api_volumes
157             environment:
158               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
159         step_5:
160           nova_api_discover_hosts:
161             start_order: 1
162             image: *nova_api_image
163             net: host
164             detach: false
165             volumes: *nova_api_volumes
166             command:
167               - '/usr/bin/nova-manage'
168               - 'cell_v2'
169               - 'discover_hosts'
170       host_prep_tasks:
171         - name: create persistent logs directory
172           file:
173             path: /var/log/containers/nova
174             state: directory
175       upgrade_tasks:
176         - name: Stop and disable nova_api service
177           tags: step2
178           service: name=openstack-nova-api state=stopped enabled=no