Merge "mysql: Only set certificate specs if TLS everywhere is enabled" into stable...
[apex-tripleo-heat-templates.git] / docker / services / nova-compute.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Nova Compute service
5
6 parameters:
7   DockerNovaComputeImage:
8     description: image
9     type: string
10   DockerNovaLibvirtConfigImage:
11     description: The container image to use for the nova_libvirt config_volume
12     type: string
13   ServiceData:
14     default: {}
15     description: Dictionary packing service data
16     type: json
17   ServiceNetMap:
18     default: {}
19     description: Mapping of service_name -> network name. Typically set
20                  via parameter_defaults in the resource registry.  This
21                  mapping overrides those in ServiceNetMapDefaults.
22     type: json
23   DefaultPasswords:
24     default: {}
25     type: json
26   RoleName:
27     default: ''
28     description: Role name on which the service is applied
29     type: string
30   RoleParameters:
31     default: {}
32     description: Parameters specific to the role
33     type: json
34   EndpointMap:
35     default: {}
36     description: Mapping of service endpoint -> protocol. Typically set
37                  via parameter_defaults in the resource registry.
38     type: json
39   DockerNovaMigrationSshdPort:
40     default: 2022
41     description: Port that dockerized nova migration target sshd service
42                  binds to.
43     type: number
44   UpgradeLevelNovaCompute:
45     type: string
46     description: Nova Compute upgrade level
47     default: ''
48   UpgradeRemoveUnusedPackages:
49     default: false
50     description: Remove package if the service is being disabled during upgrade
51     type: boolean
52
53 resources:
54
55   ContainersCommon:
56     type: ./containers-common.yaml
57
58   MySQLClient:
59     type: ../../puppet/services/database/mysql-client.yaml
60
61   NovaComputeBase:
62     type: ../../puppet/services/nova-compute.yaml
63     properties:
64       EndpointMap: {get_param: EndpointMap}
65       ServiceData: {get_param: ServiceData}
66       ServiceNetMap: {get_param: ServiceNetMap}
67       DefaultPasswords: {get_param: DefaultPasswords}
68       RoleName: {get_param: RoleName}
69       RoleParameters: {get_param: RoleParameters}
70
71 outputs:
72   role_data:
73     description: Role data for the Nova Compute service.
74     value:
75       service_name: {get_attr: [NovaComputeBase, role_data, service_name]}
76       config_settings:
77         get_attr: [NovaComputeBase, role_data, config_settings]
78       logging_source: {get_attr: [NovaComputeBase, role_data, logging_source]}
79       logging_groups: {get_attr: [NovaComputeBase, role_data, logging_groups]}
80       step_config: &step_config
81         list_join:
82           - "\n"
83           - - {get_attr: [NovaComputeBase, role_data, step_config]}
84             - {get_attr: [MySQLClient, role_data, step_config]}
85       puppet_config:
86         config_volume: nova_libvirt
87         puppet_tags: nova_config,nova_paste_api_ini
88         step_config: *step_config
89         config_image: {get_param: DockerNovaLibvirtConfigImage}
90       kolla_config:
91         /var/lib/kolla/config_files/nova_compute.json:
92           command: /usr/bin/nova-compute --config-file /etc/nova/nova.conf --config-file /etc/nova/rootwrap.conf
93           config_files:
94             - source: "/var/lib/kolla/config_files/src/*"
95               dest: "/"
96               merge: true
97               preserve_properties: true
98             - source: "/var/lib/kolla/config_files/src-iscsid/*"
99               dest: "/"
100               merge: true
101               preserve_properties: true
102             - source: "/var/lib/kolla/config_files/src-ceph/"
103               dest: "/etc/ceph/"
104               merge: true
105               preserve_properties: true
106           permissions:
107             - path: /var/log/nova
108               owner: nova:nova
109               recurse: true
110             - path: /var/lib/nova
111               owner: nova:nova
112               recurse: true
113       docker_config:
114         # FIXME: run discover hosts here
115         step_4:
116           nova_compute:
117             image: &nova_compute_image {get_param: DockerNovaComputeImage}
118             net: host
119             privileged: true
120             user: nova
121             restart: always
122             volumes:
123               list_concat:
124                 - {get_attr: [ContainersCommon, volumes]}
125                 -
126                   - /var/lib/kolla/config_files/nova_compute.json:/var/lib/kolla/config_files/config.json:ro
127                   - /var/lib/config-data/puppet-generated/nova_libvirt/:/var/lib/kolla/config_files/src:ro
128                   - /var/lib/config-data/puppet-generated/iscsid/:/var/lib/kolla/config_files/src-iscsid:ro
129                   - /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro
130                   - /dev:/dev
131                   - /lib/modules:/lib/modules:ro
132                   - /run:/run
133                   - /var/lib/nova:/var/lib/nova
134                   - /var/lib/libvirt:/var/lib/libvirt
135                   - /var/log/containers/nova:/var/log/nova
136                   - /sys/class/net:/sys/class/net
137                   - /sys/bus/pci:/sys/bus/pci
138             environment:
139              - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
140       host_prep_tasks:
141         - name: create persistent directories
142           file:
143             path: "{{ item }}"
144             state: directory
145           with_items:
146             - /var/log/containers/nova
147             - /var/lib/nova
148             - /var/lib/libvirt
149         - name: ensure ceph configurations exist
150           file:
151             path: /etc/ceph
152             state: directory
153       upgrade_tasks:
154         - name: Set compute upgrade level to auto
155           tags: step1
156           ini_file:
157             str_replace:
158               template: "dest=/etc/nova/nova.conf section=upgrade_levels option=compute value=LEVEL"
159               params:
160                 LEVEL: {get_param: UpgradeLevelNovaCompute}
161         - name: Stop and disable nova-compute service
162           tags: step2
163           service: name=openstack-nova-compute state=stopped enabled=no
164         - name: Remove openstack-nova-compute package if operator requests it
165           yum: name=openstack-nova-compute state=removed
166           tags: step2
167           ignore_errors: True
168           when: {get_param: UpgradeRemoveUnusedPackages}