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