Merge "Update Dell EMC Cinder back end services"
[apex-tripleo-heat-templates.git] / docker / services / nova-api.yaml
1 heat_template_version: ocata
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
34 resources:
35
36   NovaApiBase:
37     type: ../../puppet/services/nova-api.yaml
38     properties:
39       EndpointMap: {get_param: EndpointMap}
40       ServiceNetMap: {get_param: ServiceNetMap}
41       DefaultPasswords: {get_param: DefaultPasswords}
42
43 outputs:
44   role_data:
45     description: Role data for the Nova API role.
46     value:
47       service_name: {get_attr: [NovaApiBase, role_data, service_name]}
48       config_settings:
49         map_merge:
50           - get_attr: [NovaApiBase, role_data, config_settings]
51           - apache::default_vhost: false
52       step_config: &step_config
53         list_join:
54           - "\n"
55           - - "['Nova_cell_v2'].each |String $val| { noop_resource($val) }"
56             - {get_attr: [NovaApiBase, role_data, step_config]}
57       service_config_settings: {get_attr: [NovaApiBase, role_data, service_config_settings]}
58       # BEGIN DOCKER SETTINGS
59       puppet_config:
60         config_volume: nova
61         puppet_tags: nova_config
62         step_config: *step_config
63         config_image:
64           list_join:
65           - '/'
66           - [ {get_param: DockerNamespace}, {get_param: DockerNovaConfigImage} ]
67       kolla_config:
68         /var/lib/kolla/config_files/nova_api.json:
69           command: /usr/bin/nova-api
70       docker_config:
71         step_3:
72           nova_api_db_sync:
73             start_order: 1
74             image: &nova_api_image
75               list_join:
76                 - '/'
77                 - [ {get_param: DockerNamespace}, {get_param: DockerNovaApiImage} ]
78             net: host
79             detach: false
80             volumes: &nova_api_volumes
81               - /var/lib/config-data/nova/etc/:/etc/:ro
82               - /etc/hosts:/etc/hosts:ro
83               - /etc/localtime:/etc/localtime:ro
84             command: ['/usr/bin/nova-manage', 'api_db', 'sync']
85           # FIXME: we probably want to wait on the 'cell_v2 update' in order for this
86           # to be capable of upgrading a baremetal setup. This is to ensure the name
87           # of the cell is 'default'
88           nova_api_map_cell0:
89             start_order: 2
90             image: *nova_api_image
91             net: host
92             detach: false
93             volumes: *nova_api_volumes
94             command:
95               - '/usr/bin/nova-manage'
96               - 'cell_v2'
97               - 'map_cell0'
98           nova_api_create_default_cell:
99             start_order: 3
100             image: *nova_api_image
101             net: host
102             detach: false
103             volumes: *nova_api_volumes
104             # NOTE: allowing the exit code 2 is a dirty way of making
105             # this idempotent (if the resource already exists a conflict
106             # is raised)
107             exit_codes: [0,2]
108             command:
109               - '/usr/bin/nova-manage'
110               - 'cell_v2'
111               - 'create_cell'
112               - '--name="default"'
113           nova_db_sync:
114             start_order: 4
115             image: *nova_api_image
116             net: host
117             detach: false
118             volumes: *nova_api_volumes
119             command: ['/usr/bin/nova-manage', 'db', 'sync']
120         step_4:
121           nova_api:
122             start_order: 2
123             image: *nova_api_image
124             net: host
125             user: nova
126             privileged: true
127             restart: always
128             volumes:
129               - /var/lib/kolla/config_files/nova_api.json:/var/lib/kolla/config_files/config.json:ro
130               - /var/lib/config-data/nova/etc/nova/:/etc/nova/:ro
131               - /etc/hosts:/etc/hosts:ro
132               - /etc/localtime:/etc/localtime:ro
133             environment:
134               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
135         step_5:
136           nova_api_discover_hosts:
137             start_order: 1
138             image: *nova_api_image
139             net: host
140             detach: false
141             volumes: *nova_api_volumes
142             command:
143               - '/usr/bin/nova-manage'
144               - 'cell_v2'
145               - 'discover_hosts'
146       upgrade_tasks:
147         - name: Stop and disable nova_api service
148           tags: step2
149           service: name=openstack-nova-api state=stopped enabled=no