Merge "Add validation for VPP upgrade tasks"
[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   DockerNovaBaseImage:
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         get_attr: [NovaApiBase, role_data, step_config]
54       service_config_settings: {get_attr: [NovaApiBase, role_data, service_config_settings]}
55       # BEGIN DOCKER SETTINGS
56       docker_image: &nova_api_image
57         list_join:
58           - '/'
59           - [ {get_param: DockerNamespace}, {get_param: DockerNovaApiImage} ]
60       puppet_config:
61         config_volume: nova
62         puppet_tags: nova_config
63         step_config: *step_config
64         config_image:
65           list_join:
66           - '/'
67           - [ {get_param: DockerNamespace}, {get_param: DockerNovaBaseImage} ]
68       kolla_config:
69          /var/lib/kolla/config_files/nova_api.json:
70            command: /usr/bin/nova-api
71            config_files:
72            - dest: /etc/nova/nova.conf
73              owner: nova
74              perm: '0640'
75              source: /var/lib/kolla/config_files/src/etc/nova/nova.conf
76       docker_config:
77         step_3:
78           nova_api_db_sync:
79             start_order: 1
80             image: *nova_api_image
81             net: host
82             detach: false
83             volumes: &nova_api_volumes
84               - /var/lib/config-data/nova/etc/:/etc/:ro
85               - /etc/hosts:/etc/hosts:ro
86               - /etc/localtime:/etc/localtime:ro
87             command: ['/usr/bin/nova-manage', 'api_db', 'sync']
88           # FIXME: we probably want to wait on the 'cell_v2 update' in order for this
89           # to be capable of upgrading a baremetal setup. This is to ensure the name
90           # of the cell is 'default'
91           nova_api_map_cell0:
92             start_order: 2
93             image: *nova_api_image
94             net: host
95             detach: false
96             volumes: *nova_api_volumes
97             command:
98               - '/usr/bin/nova-manage'
99               - 'cell_v2'
100               - 'map_cell0'
101           nova_api_create_default_cell:
102             start_order: 3
103             image: *nova_api_image
104             net: host
105             detach: false
106             volumes: *nova_api_volumes
107             # NOTE: allowing the exit code 2 is a dirty way of making
108             # this idempotent (if the resource already exists a conflict
109             # is raised)
110             exit_codes: [0,2]
111             command:
112               - '/usr/bin/nova-manage'
113               - 'cell_v2'
114               - 'create_cell'
115               - '--name="default"'
116           nova_db_sync:
117             start_order: 4
118             image: *nova_api_image
119             net: host
120             detach: false
121             volumes: *nova_api_volumes
122             command: ['/usr/bin/nova-manage', 'db', 'sync']
123         step_4:
124           nova_api:
125             start_order: 2
126             image: *nova_api_image
127             net: host
128             user: nova
129             privileged: true
130             restart: always
131             volumes:
132               - /var/lib/kolla/config_files/nova_api.json:/var/lib/kolla/config_files/config.json:ro
133               - /var/lib/config-data/nova/:/var/lib/kolla/config_files/src:ro
134               - /etc/hosts:/etc/hosts:ro
135               - /etc/localtime:/etc/localtime:ro
136             environment:
137               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
138           nova_api_discover_hosts:
139             start_order: 3
140             image: *nova_api_image
141             net: host
142             detach: false
143             volumes: *nova_api_volumes
144             command:
145               - '/usr/bin/nova-manage'
146               - 'cell_v2'
147               - 'discover_hosts'
148       upgrade_tasks:
149         - name: Stop and disable nova_api service
150           tags: step2
151           service: name=openstack-nova-api state=stopped enabled=no