Skip to content

Commit

Permalink
Only wait for start and stop when service state has changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Richter committed Jan 26, 2018
1 parent 2053ad5 commit c787166
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Stops the `aem-author` instance and waits for the shutdown to complete:
- hosts: aem-author
roles:
- { role: aem-service,
state: stopped,
aem_service_state: stopped,
aem_service_name: aem-author,
aem_service_port: 4502 }

Expand Down
4 changes: 3 additions & 1 deletion tasks/start_aem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
service:
name: "{{ aem_service_name }}"
state: started
register: aem_service_start_result

- name: "Wait for AEM startup. [{{ inventory_hostname }}]"
uri:
Expand All @@ -10,4 +11,5 @@
register: result
until: result.content.find("QUICKSTART_HOMEPAGE") != -1
retries: "{{ aem_service_timeout // 10 }}"
delay: 10
delay: 10
when: aem_service_start_result.changed
7 changes: 5 additions & 2 deletions tasks/stop_aem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
service:
name: "{{ aem_service_name }}"
state: stopped
register: aem_service_stop_result

- name: Wait for AEM shutdown.
wait_for:
port: "{{ aem_service_port }}"
state: stopped
delay: 10
timeout: "{{ aem_service_timeout }}"
delay: 5
timeout: "{{ aem_service_timeout }}"
register: aem_service_stop_result
when: aem_service_stop_result.changed

0 comments on commit c787166

Please sign in to comment.