blob: ec2270a0f2df4abcce2fa676934af209c7452128 [file] [log] [blame]
Jakub Pavlik1af183b2015-02-22 18:25:28 +01001{% from "libvirt/map.jinja" import server with context %}
2
3{%- if server.enabled %}
4
5libvirt_packages:
6 pkg.installed:
7 - names: {{ server.pkgs }}
8
9libvirtd_config:
10 file.managed:
11 - name: {{ server.config }}
12 - source: salt://libvirt/files/libvirtd.conf.{{ grains.os_family }}
13 - template: jinja
14 - require:
15 - pkg: libvirt_packages
16
Jakub Pavlikc75247d2015-02-23 09:18:02 +010017{%- if grains.os_family == 'RedHat' %}
18
Jakub Pavlik1af183b2015-02-22 18:25:28 +010019libvirt_sysconfig:
Jakub Pavlikc75247d2015-02-23 09:18:02 +010020 file.managed:
21 - name: /etc/sysconfig/libvirtd
22 - contents: 'LIBVIRTD_ARGS="--listen"'
Jakub Pavlik1af183b2015-02-22 18:25:28 +010023 - require:
24 - pkg: libvirt_packages
25
Jakub Pavlikc75247d2015-02-23 09:18:02 +010026{%- endif %}
27
28{%- if grains.os_family == 'Debian' %}
29
30/etc/default/libvirt-bin:
31 file.managed:
32 - source: salt://libvirt/files/libvirt-bin
33 - contents: 'LIBVIRTD_ARGS="--listen"'
34 - require:
35 - pkg: libvirt_packages
36
37{%- endif %}
38
Jakub Pavlik1af183b2015-02-22 18:25:28 +010039libvirt_service:
40 service.running:
41 - name: {{ server.service }}
42 - enable: true
43 - reload: true
44 - watch:
Jakub Pavlik4c68b142015-02-22 18:54:05 +010045 - file: libvirtd_config
Jakub Pavlik1af183b2015-02-22 18:25:28 +010046
47{%- endif %}