Jakub Pavlik | 1af183b | 2015-02-22 18:25:28 +0100 | [diff] [blame] | 1 | {% from "libvirt/map.jinja" import server with context %} |
| 2 | |
| 3 | {%- if server.enabled %} |
| 4 | |
| 5 | libvirt_packages: |
| 6 | pkg.installed: |
| 7 | - names: {{ server.pkgs }} |
| 8 | |
| 9 | libvirtd_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 Pavlik | c75247d | 2015-02-23 09:18:02 +0100 | [diff] [blame^] | 17 | {%- if grains.os_family == 'RedHat' %} |
| 18 | |
Jakub Pavlik | 1af183b | 2015-02-22 18:25:28 +0100 | [diff] [blame] | 19 | libvirt_sysconfig: |
Jakub Pavlik | c75247d | 2015-02-23 09:18:02 +0100 | [diff] [blame^] | 20 | file.managed: |
| 21 | - name: /etc/sysconfig/libvirtd |
| 22 | - contents: 'LIBVIRTD_ARGS="--listen"' |
Jakub Pavlik | 1af183b | 2015-02-22 18:25:28 +0100 | [diff] [blame] | 23 | - require: |
| 24 | - pkg: libvirt_packages |
| 25 | |
Jakub Pavlik | c75247d | 2015-02-23 09:18:02 +0100 | [diff] [blame^] | 26 | {%- 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 Pavlik | 1af183b | 2015-02-22 18:25:28 +0100 | [diff] [blame] | 39 | libvirt_service: |
| 40 | service.running: |
| 41 | - name: {{ server.service }} |
| 42 | - enable: true |
| 43 | - reload: true |
| 44 | - watch: |
Jakub Pavlik | 4c68b14 | 2015-02-22 18:54:05 +0100 | [diff] [blame] | 45 | - file: libvirtd_config |
Jakub Pavlik | 1af183b | 2015-02-22 18:25:28 +0100 | [diff] [blame] | 46 | |
| 47 | {%- endif %} |