Merge "Add defaults for docker puppet tasks"
[apex-tripleo-heat-templates.git] / docker / services / nova-libvirt.yaml
1 heat_template_version: ocata
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   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   NovaLibvirtBase:
42     type: ../../puppet/services/nova-libvirt.yaml
43     properties:
44       EndpointMap: {get_param: EndpointMap}
45       ServiceNetMap: {get_param: ServiceNetMap}
46       DefaultPasswords: {get_param: DefaultPasswords}
47
48 outputs:
49   role_data:
50     description: Role data for the Libvirt service.
51     value:
52       service_name: {get_attr: [NovaLibvirtBase, role_data, service_name]}
53       config_settings: {get_attr: [NovaLibvirtBase, role_data, config_settings]}
54       step_config: &step_config
55         get_attr: [NovaLibvirtBase, role_data, step_config]
56       puppet_config:
57         config_volume: nova_libvirt
58         puppet_tags: nova_config
59         step_config: *step_config
60         config_image:
61           list_join:
62           - '/'
63           - [ {get_param: DockerNamespace}, {get_param: DockerNovaConfigImage} ]
64       kolla_config:
65         /var/lib/kolla/config_files/nova-libvirt.json:
66           command: /usr/sbin/libvirtd --config /etc/libvirt/libvirtd.conf
67       docker_config:
68         step_3:
69           nova_libvirt:
70             image:
71               list_join:
72               - '/'
73               - [ {get_param: DockerNamespace}, {get_param: DockerLibvirtImage} ]
74             net: host
75             pid: host
76             privileged: true
77             restart: always
78             volumes:
79               yaql:
80                 expression: $.data.common.concat($.data.service)
81                 data:
82                   common: {get_attr: [ContainersCommon, volumes]}
83                   service:
84                     - /var/lib/kolla/config_files/nova-libvirt.json:/var/lib/kolla/config_files/config.json:ro
85                     - /var/lib/config-data/nova_libvirt/etc/libvirt/:/etc/libvirt/:ro
86                     - /lib/modules:/lib/modules:ro
87                     - /dev:/dev
88                     - /run:/run
89                     - /sys/fs/cgroup:/sys/fs/cgroup
90                     - /var/lib/nova:/var/lib/nova
91                     # Needed to use host's virtlogd
92                     - /var/run/libvirt:/var/run/libvirt
93                     - /var/lib/libvirt:/var/lib/libvirt
94                     - /etc/libvirt/qemu:/etc/libvirt/qemu
95             environment:
96               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
97       host_prep_tasks:
98         - name: create libvirt persistent data directories
99           file:
100             path: "{{ item }}"
101             state: directory
102           with_items:
103             - /etc/libvirt/qemu
104             - /var/lib/libvirt
105       upgrade_tasks:
106         - name: Stop and disable libvirtd service
107           tags: step2
108           service: name=libvirtd state=stopped enabled=no