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