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