Make containerized galera use mysql_network everywhere
[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
49 resources:
50
51   ContainersCommon:
52     type: ./containers-common.yaml
53
54   MySQLClient:
55     type: ../../puppet/services/database/mysql-client.yaml
56
57   NovaComputeBase:
58     type: ../../puppet/services/nova-compute.yaml
59     properties:
60       EndpointMap: {get_param: EndpointMap}
61       ServiceData: {get_param: ServiceData}
62       ServiceNetMap: {get_param: ServiceNetMap}
63       DefaultPasswords: {get_param: DefaultPasswords}
64       RoleName: {get_param: RoleName}
65       RoleParameters: {get_param: RoleParameters}
66
67 outputs:
68   role_data:
69     description: Role data for the Nova Compute service.
70     value:
71       service_name: {get_attr: [NovaComputeBase, role_data, service_name]}
72       config_settings:
73         get_attr: [NovaComputeBase, role_data, config_settings]
74       step_config: &step_config
75         list_join:
76           - "\n"
77           - - {get_attr: [NovaComputeBase, role_data, step_config]}
78             - {get_attr: [MySQLClient, role_data, step_config]}
79       puppet_config:
80         config_volume: nova_libvirt
81         puppet_tags: nova_config,nova_paste_api_ini
82         step_config: *step_config
83         config_image: {get_param: DockerNovaLibvirtConfigImage}
84       kolla_config:
85         /var/lib/kolla/config_files/nova_compute.json:
86           command: /usr/bin/nova-compute --config-file /etc/nova/nova.conf --config-file /etc/nova/rootwrap.conf
87           config_files:
88             - source: "/var/lib/kolla/config_files/src/*"
89               dest: "/"
90               merge: true
91               preserve_properties: true
92             - source: "/var/lib/kolla/config_files/src-iscsid/*"
93               dest: "/"
94               merge: true
95               preserve_properties: true
96             - source: "/var/lib/kolla/config_files/src-ceph/"
97               dest: "/etc/ceph/"
98               merge: true
99               preserve_properties: true
100           permissions:
101             - path: /var/log/nova
102               owner: nova:nova
103               recurse: true
104             - path: /var/lib/nova
105               owner: nova:nova
106               recurse: true
107       docker_config:
108         # FIXME: run discover hosts here
109         step_4:
110           nova_compute:
111             image: &nova_compute_image {get_param: DockerNovaComputeImage}
112             net: host
113             privileged: true
114             user: nova
115             restart: always
116             volumes:
117               list_concat:
118                 - {get_attr: [ContainersCommon, volumes]}
119                 -
120                   - /var/lib/kolla/config_files/nova_compute.json:/var/lib/kolla/config_files/config.json:ro
121                   - /var/lib/config-data/puppet-generated/nova_libvirt/:/var/lib/kolla/config_files/src:ro
122                   - /var/lib/config-data/puppet-generated/iscsid/:/var/lib/kolla/config_files/src-iscsid:ro
123                   - /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro
124                   - /dev:/dev
125                   - /lib/modules:/lib/modules:ro
126                   - /run:/run
127                   - /var/lib/nova:/var/lib/nova
128                   - /var/lib/libvirt:/var/lib/libvirt
129                   - /var/log/containers/nova:/var/log/nova
130                   - /sys/class/net:/sys/class/net
131                   - /sys/bus/pci:/sys/bus/pci
132             environment:
133              - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
134       host_prep_tasks:
135         - name: create persistent directories
136           file:
137             path: "{{ item }}"
138             state: directory
139           with_items:
140             - /var/log/containers/nova
141             - /var/lib/nova
142             - /var/lib/libvirt
143         - name: ensure ceph configurations exist
144           file:
145             path: /etc/ceph
146             state: directory
147       upgrade_tasks:
148         - name: Set compute upgrade level to auto
149           tags: step1
150           ini_file:
151             str_replace:
152               template: "dest=/etc/nova/nova.conf section=upgrade_levels option=compute value=LEVEL"
153               params:
154                 LEVEL: {get_param: UpgradeLevelNovaCompute}
155         - name: Stop and disable nova-compute service
156           tags: step2
157           service: name=openstack-nova-compute state=stopped enabled=no