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
--- 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
-