[libvirt] [libvirt-jenkins-ci PATCH 1/2] ansible: Use systemd module

Andrea Bolognani abologna at redhat.com
Wed Oct 11 08:52:17 UTC 2017


Using the module is preferable to calling systemctl(1) directly
because it's better integrated into Ansible (eg. the task will be
marked as "ok" instead of "changed" when the service has already
been enabled) and allows us to perform service activation in a
single step instead of two.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 ansible/tasks/jenkins.yml | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/ansible/tasks/jenkins.yml b/ansible/tasks/jenkins.yml
index 087033d..563f220 100644
--- a/ansible/tasks/jenkins.yml
+++ b/ansible/tasks/jenkins.yml
@@ -48,12 +48,10 @@
   when:
     - use_systemd
 
-- name: Reload systemd status
-  command: systemctl daemon-reload
-  when:
-    - use_systemd
-
 - name: Enable Jenkins agent
-  command: systemctl enable jenkins
+  systemd:
+    name: jenkins.service
+    enabled: yes
+    daemon_reload: yes
   when:
     - use_systemd
-- 
2.13.6




More information about the libvir-list mailing list