101934ff8f3f8e3ab9199c0fb0cd418e61821b10
[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   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerNovaComputeImage:
12     description: image
13     default: 'centos-binary-nova-compute:latest'
14     type: string
15   DockerNovaLibvirtConfigImage:
16     description: The container image to use for the nova_libvirt config_volume
17     default: 'centos-binary-nova-compute:latest'
18     type: string
19   ServiceNetMap:
20     default: {}
21     description: Mapping of service_name -> network name. Typically set
22                  via parameter_defaults in the resource registry.  This
23                  mapping overrides those in ServiceNetMapDefaults.
24     type: json
25   DefaultPasswords:
26     default: {}
27     type: json
28   RoleName:
29     default: ''
30     description: Role name on which the service is applied
31     type: string
32   RoleParameters:
33     default: {}
34     description: Parameters specific to the role
35     type: json
36   EndpointMap:
37     default: {}
38     description: Mapping of service endpoint -> protocol. Typically set
39                  via parameter_defaults in the resource registry.
40     type: json
41
42 resources:
43
44   ContainersCommon:
45     type: ./containers-common.yaml
46
47   NovaComputeBase:
48     type: ../../puppet/services/nova-compute.yaml
49     properties:
50       EndpointMap: {get_param: EndpointMap}
51       ServiceNetMap: {get_param: ServiceNetMap}
52       DefaultPasswords: {get_param: DefaultPasswords}
53       RoleName: {get_param: RoleName}
54       RoleParameters: {get_param: RoleParameters}
55
56 outputs:
57   role_data:
58     description: Role data for the Nova Compute service.
59     value:
60       service_name: {get_attr: [NovaComputeBase, role_data, service_name]}
61       config_settings:
62         map_merge:
63           - get_attr: [NovaComputeBase, role_data, config_settings]
64           # FIXME: we need to disable migration for now as the
65           # hieradata is common for all services, and this means nova
66           # and nova_placement puppet runs also try to configure
67           # libvirt, and they fail. We can remove this override when
68           # we have hieradata separation between containers.
69           - tripleo::profile::base::nova::manage_migration: false
70       step_config: &step_config
71         get_attr: [NovaComputeBase, role_data, step_config]
72       puppet_config:
73         config_volume: nova_libvirt
74         puppet_tags: nova_config,nova_paste_api_ini
75         step_config: *step_config
76         config_image:
77           list_join:
78           - '/'
79           - [ {get_param: DockerNamespace}, {get_param: DockerNovaLibvirtConfigImage} ]
80       kolla_config:
81         /var/lib/kolla/config_files/nova_compute.json:
82           command: /usr/bin/nova-compute --config-file /etc/nova/nova.conf --config-file /etc/nova/rootwrap.conf
83           config_files:
84             - source: "/var/lib/kolla/config_files/src/*"
85               dest: "/"
86               merge: true
87               preserve_properties: true
88           permissions:
89             - path: /var/log/nova
90               owner: nova:nova
91               recurse: true
92             - path: /var/lib/nova
93               owner: nova:nova
94               recurse: true
95       docker_config:
96         # FIXME: run discover hosts here
97         step_4:
98           nova_compute:
99             image: &nova_compute_image
100               list_join:
101               - '/'
102               - [ {get_param: DockerNamespace}, {get_param: DockerNovaComputeImage} ]
103             net: host
104             privileged: true
105             user: nova
106             restart: always
107             volumes:
108               list_concat:
109                 - {get_attr: [ContainersCommon, volumes]}
110                 -
111                   - /var/lib/kolla/config_files/nova_compute.json:/var/lib/kolla/config_files/config.json:ro
112                   - /var/lib/config-data/puppet-generated/nova_libvirt/:/var/lib/kolla/config_files/src:ro
113                   - /dev:/dev
114                   - /etc/iscsi:/etc/iscsi
115                   - /lib/modules:/lib/modules:ro
116                   - /run:/run
117                   - /var/lib/nova:/var/lib/nova
118                   - /var/lib/libvirt:/var/lib/libvirt
119                   - /var/log/containers/nova:/var/log/nova
120             environment:
121              - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
122       host_prep_tasks:
123         - name: create persistent directories
124           file:
125             path: "{{ item }}"
126             state: directory
127           with_items:
128             - /var/log/containers/nova
129             - /var/lib/nova
130             - /var/lib/libvirt
131       upgrade_tasks:
132         - name: Stop and disable nova-compute service
133           tags: step2
134           service: name=openstack-nova-compute state=stopped enabled=no