Skip to content

Commit

Permalink
Check for ansible_service_mgr when installing services
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestas-poskus committed Sep 12, 2016
1 parent 3de781d commit 1aacf68
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
5 changes: 3 additions & 2 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
# While waiting for https://github.com/ansible/ansible-modules-core/issues/191
- name: Reload daemon
command: systemctl daemon-reload

when: ansible_service_mgr == 'systemd'

# i.e. upgrade mesos, templates stay the same...
- name: Restart mesos-master
service: name=mesos-master state=restarted
when: mesos_install_mode == "master" or mesos_install_mode == "master-slave"

- name: Restart mesos-slave
- name: Restart mesos-slave
service: name=mesos-slave state=restarted
when: mesos_install_mode == "slave" or mesos_install_mode == "master-slave"
16 changes: 8 additions & 8 deletions tasks/mesos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,26 @@
notify:
- Restart mesos-slave

- name: Check if upstart exists
stat: path=/etc/init/
register: etc_init

- name: Mesos master upstart script
template: src=init-mesos-master.j2 dest=/etc/init/mesos-master.conf
when: (mesos_install_mode == "master" or mesos_install_mode == "master-slave") and etc_init.stat.exists == true
when:
- (mesos_install_mode == "master" or mesos_install_mode == "master-slave")
- ansible_service_mgr != 'systemd'
notify:
- Restart mesos-master

- name: Mesos slave upstart script
template: src=init-mesos-slave.j2 dest=/etc/init/mesos-slave.conf
when: (mesos_install_mode == "slave" or mesos_install_mode == "master-slave") and etc_init.stat.exists == true
when:
- (mesos_install_mode == "slave" or mesos_install_mode == "master-slave")
- ansible_service_mgr != 'systemd'
notify:
- Restart mesos-slave

- name: Check if systemd exists
stat: path=/usr/lib/systemd/system/
register: systemd_check

- name: Mesos master systemd script
template: src=mesos-master.service.j2 dest=/usr/lib/systemd/system/mesos-master.service
when: (mesos_install_mode == "master" or mesos_install_mode == "master-slave") and systemd_check.stat.exists == true
Expand Down
2 changes: 0 additions & 2 deletions tests/inventory

This file was deleted.

0 comments on commit 1aacf68

Please sign in to comment.