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