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