ansible/hg-ssh: consolidate service management (bug 1299976); r?fubar draft
authorGregory Szorc <gps@mozilla.com>
Thu, 01 Sep 2016 16:50:51 -0700 (2016-09-01)
changeset 9520 84136cbccdf339ce744af63d063172e191648107
parent 9519 7d1331355db006a689ba2799bb8ed7e466ec30ce
push id1200
push userbmo:gps@mozilla.com
push dateThu, 01 Sep 2016 23:58:22 +0000 (2016-09-01)
reviewersfubar
bugs1299976
ansible/hg-ssh: consolidate service management (bug 1299976); r?fubar We can use state=restarted to restart a service. This means we only need 1 service block, not 2. MozReview-Commit-ID: 2zyuQ6r8PSX
ansible/roles/hg-ssh/tasks/main.yml
--- a/ansible/roles/hg-ssh/tasks/main.yml
+++ b/ansible/roles/hg-ssh/tasks/main.yml
@@ -215,26 +215,23 @@
   copy: src=unifyrepo.service
         dest=/etc/systemd/system/unifyrepo.service
         owner=root
         group=root
         mode=0644
   notify: systemd daemon reload
   when: vct_dir.stat.exists == False
 
-- name: unifyrepo.service is enabled (server only)
+- name: unifyrepo.service is enabled and restarted (server only)
   service: name=unifyrepo.service
            enabled=yes
+           state=restarted
+  ignore_errors: True
   when: vct_dir.stat.exists == False
 
-- name: restart unifyrepo.service (server only)
-  command: /usr/bin/systemctl restart unifyrepo.service
-  when: vct_dir.stat.exists == False
-  ignore_errors: True
-
 - name: systemd service for bundle generation
   copy: src=hg-bundle-generate.{{ item }}
         dest=/etc/systemd/system/hg-bundle-generate.{{ item }}
         owner=root
         group=root
         mode=0644
   with_items:
     - service
@@ -301,37 +298,30 @@
   copy: src=pushdataaggregator.service
         dest=/etc/systemd/system/pushdataaggregator.service
         owner=root
         group=root
         mode=0644
   notify: systemd daemon reload
   when: vct_dir.stat.exists == False
 
-- name: pushdataaggregator.service is enabled (server only)
+- name: pushdataaggregator.service is enabled and restarted (server only)
   service: name=pushdataaggregator.service
            enabled=yes
+           state=restarted
+  ignore_errors: True
   when: vct_dir.stat.exists == False
 
-- name: restart pushdataaggregator.service (server only)
-  command: /usr/bin/systemctl restart pushdataaggregator.service
-  when: vct_dir.stat.exists == False
-  ignore_errors: True
-
 - name: systemd service file for pulse notification daemon
   copy: src=pulsenotifier.service
         dest=/etc/systemd/system/pulsenotifier.service
         owner=root
         group=root
         mode=0644
   notify: systemd daemon reload
   when: vct_dir.stat.exists == False
 
-- name: pulsenotifier.service is enabled (server only)
+- name: pulsenotifier.service is enabled and restarted (server only)
   service: name=pulsenotifier.service
            enabled=yes
+           state=restarted
+  ignore_errors: True
   when: vct_dir.stat.exists == False
-
-- name: restart pulsenotifier.service (server only)
-  command: /usr/bin/systemctl restart pulsenotifier.service
-  when: vct_dir.stat.exists == False
-  ignore_errors: True
-