Skip to content

Commit

Permalink
manager: wait for manager service to start (#1236)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berendt <[email protected]>
  • Loading branch information
berendt committed Dec 7, 2023
1 parent c5e585b commit 97eba56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion roles/manager/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
state: restarted
when: manager_service_restart|bool
notify:
- Ensure that all containers are up
- Wait for manager service to start
- Register that manager service was restarted

- name: Wait for manager service to start
ansible.builtin.pause:
minutes: 1
notify:
- Ensure that all containers are up

# NOTE: This handler prevents a 2nd manager restart in the
# osism.manager.manager playbook.
- name: Register that manager service was restarted
Expand Down
4 changes: 3 additions & 1 deletion roles/manager/tasks/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
state: started
enabled: true
notify:
- Ensure that all containers are up
- Wait for manager service to start
rescue:
# Compose is not always reliable when starting services. Therefore,
# in case of an error at startup, another stop and start of the
Expand All @@ -51,6 +51,8 @@
- name: Do a manual start of the manager service
ansible.builtin.command: "/usr/bin/docker compose --project-directory {{ manager_docker_compose_directory }} up -d --remove-orphans"
changed_when: true
notify:
- Wait for manager service to start

# This does not change anything on the service side, but the unit is
# then in the expected state.
Expand Down

0 comments on commit 97eba56

Please sign in to comment.