From: Michael Scherer <misc(a)zarb.org>
---
files/virthost/libvirtd.conf | 3 ---
handlers/restart_services.yml | 3 ---
playbooks/groups/virthost.yml | 2 +-
roles/virthost/files/libvirtd.conf | 3 +++
roles/virthost/handlers/main.yml | 5 +++++
roles/virthost/tasks/main.yml | 28 ++++++++++++++++++++++++++++
tasks/virthost.yml | 28 ----------------------------
7 files changed, 37 insertions(+), 35 deletions(-)
delete mode 100644 files/virthost/libvirtd.conf
create mode 100644 roles/virthost/files/libvirtd.conf
create mode 100644 roles/virthost/handlers/main.yml
create mode 100644 roles/virthost/tasks/main.yml
delete mode 100644 tasks/virthost.yml
diff --git a/files/virthost/libvirtd.conf b/files/virthost/libvirtd.conf
deleted file mode 100644
index e36ce0a..0000000
--- a/files/virthost/libvirtd.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-unix_sock_group = "sysadmin-main"
-unix_sock_rw_perms = "0770"
-auth_unix_rw = "none"
diff --git a/handlers/restart_services.yml b/handlers/restart_services.yml
index 23aa481..b311acb 100644
--- a/handlers/restart_services.yml
+++ b/handlers/restart_services.yml
@@ -38,9 +38,6 @@
- name: restart jenkins
action: service name=jenkins state=restarted
-- name: restart libvirtd
- action: service name=libvirtd state=restarted
-
- name: restart lighttpd
action: service name=lighttpd state=restarted
diff --git a/playbooks/groups/virthost.yml b/playbooks/groups/virthost.yml
index c03453e..ab15a7c 100644
--- a/playbooks/groups/virthost.yml
+++ b/playbooks/groups/virthost.yml
@@ -17,6 +17,7 @@
- /srv/web/infra/ansible/roles/denyhosts
- /srv/web/infra/ansible/roles/nagios_client
- /srv/web/infra/ansible/roles/fas_client
+ - /srv/web/infra/ansible/roles/virthost
tasks:
- include: $tasks/hosts.yml
@@ -26,7 +27,6 @@
- include: $tasks/motd.yml
- include: $tasks/sudo.yml
- include: $tasks/collectd/client.yml
- - include: $tasks/virthost.yml
# TODO: add iscsi task
diff --git a/roles/virthost/files/libvirtd.conf b/roles/virthost/files/libvirtd.conf
new file mode 100644
index 0000000..e36ce0a
--- /dev/null
+++ b/roles/virthost/files/libvirtd.conf
@@ -0,0 +1,3 @@
+unix_sock_group = "sysadmin-main"
+unix_sock_rw_perms = "0770"
+auth_unix_rw = "none"
diff --git a/roles/virthost/handlers/main.yml b/roles/virthost/handlers/main.yml
new file mode 100644
index 0000000..6bbc608
--- /dev/null
+++ b/roles/virthost/handlers/main.yml
@@ -0,0 +1,5 @@
+---
+- name: restart libvirtd
+ action: service name=libvirtd state=restarted
+
+
diff --git a/roles/virthost/tasks/main.yml b/roles/virthost/tasks/main.yml
new file mode 100644
index 0000000..abde30b
--- /dev/null
+++ b/roles/virthost/tasks/main.yml
@@ -0,0 +1,28 @@
+---
+# tasklist for setting up the virthost server.
+
+- name: set selinux to enforcing
+ selinux: policy=targeted state=enforcing
+
+- name: install libvirt packages
+ yum: pkg=$item state=installed
+ with_items:
+ - qemu-kvm
+ - libvirt
+ - python-virtinst
+ tags:
+ - packages
+
+# install libvirtd.conf
+#
+# This provides us with the ability to use virt-manager from non root accounts.
+#
+- name: install libvirtd.conf
+ copy: src=libvirtd.conf dest=/etc/libvirt/libvirtd.conf
+ notify:
+ - restart libvirtd
+ tags:
+ - config
+
+- name: enable libvirtd
+ service: name=libvirtd state=started enabled=yes
diff --git a/tasks/virthost.yml b/tasks/virthost.yml
deleted file mode 100644
index 4b3ea2d..0000000
--- a/tasks/virthost.yml
+++ /dev/null
@@ -1,28 +0,0 @@
----
-# tasklist for setting up the virthost server.
-
-- name: set selinux to enforcing
- selinux: policy=targeted state=enforcing
-
-- name: install libvirt packages
- yum: pkg=$item state=installed
- with_items:
- - qemu-kvm
- - libvirt
- - python-virtinst
- tags:
- - packages
-
-# install libvirtd.conf
-#
-# This provides us with the ability to use virt-manager from non root accounts.
-#
-- name: install libvirtd.conf
- copy: src=$files/virthost/libvirtd.conf dest=/etc/libvirt/libvirtd.conf
- notify:
- - restart libvirtd
- tags:
- - config
-
-- name: enable libvirtd
- service: name=libvirtd state=started enabled=yes
--
1.8.3.1