Skip to content

Commit

Permalink
Marathon service (re)started on config create/update using a handler (#…
Browse files Browse the repository at this point in the history
…30)

* Marathon service (re)started on config create/update using a handler

* ensure Marathon service started

* review fix: remove service task tag
  • Loading branch information
lhoss authored and ernestas-poskus committed Sep 9, 2016
1 parent 575d42c commit f325b45
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: Restart marathon
service: name=marathon state=restarted
14 changes: 14 additions & 0 deletions tasks/conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,62 @@

- name: Set required --master option
template: src=master.j2 dest=/etc/marathon/conf/master
notify: Restart marathon

- name: Remove optional --artifact_store option
file: path=/etc/marathon/conf/artifact_store state=absent
when: artifact_store == ""
notify: Restart marathon

- name: Set optional --artifact_store option
template: src=artifact_store.j2 dest=/etc/marathon/conf/artifact_store
when: artifact_store != ""
notify: Restart marathon

- name: Remove optional --checkpoint option
file: path=/etc/marathon/conf/?checkpoint state=absent
when: checkpoint == ""
notify: Restart marathon

- name: Set optional --checkpoint option
file: path=/etc/marathon/conf/?checkpoint state=touch
when: checkpoint != ""
notify: Restart marathon

- name: Remove optional --zk option
file: path=/etc/marathon/conf/zk state=absent
when: marathon_zookeeper_state == ""
notify: Restart marathon

- name: Set optional --zk option
template: src=zk.j2 dest=/etc/marathon/conf/zk
when: marathon_zookeeper_state != ""
notify: Restart marathon

- name: Remove optional --mesos_role option
file: path=/etc/marathon/conf/mesos_role state=absent
when: marathon_mesos_role == ""
notify: Restart marathon

- name: Set optional --mesos_role option
template: src=mesos_role.j2 dest=/etc/marathon/conf/mesos_role
when: marathon_mesos_role != ""
notify: Restart marathon

- name: Set --hostname option
template: src=hostname.j2 dest=/etc/marathon/conf/hostname
notify: Restart marathon

- name: Set --http-port option
template: src=http_port.j2 dest=/etc/marathon/conf/http_port
notify: Restart marathon

- name: Set additional options
copy:
content: "{{ item.value }}"
dest: "/etc/marathon/conf/{{ item.name }}"
with_items: marathon_additional_configs
notify: Restart marathon
tags:
- config-additional

Expand All @@ -64,7 +76,9 @@
lineinfile: dest=/etc/init/marathon.conf backup=yes state=present insertbefore='exec.*' line="env {{ item }}"
with_items: marathon_env_vars
when: etc_init_check.stat.exists == true
notify: Restart marathon

- name: systemd environment variables
template: src=sysconfig.j2 dest=/etc/sysconfig/marathon
when: systemd_check.stat.exists == true
notify: Restart marathon
6 changes: 2 additions & 4 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@
tags:
- haproxy

- name: Start Marathon service
service: name=marathon state=restarted enabled=yes
tags:
- restart
- name: Enable Marathon service
service: name=marathon enabled=yes state=started

0 comments on commit f325b45

Please sign in to comment.