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