infrastructure/playbooks/tasks/steps/start-service.yml

40 lines
1,003 B
YAML
Raw Normal View History

2024-09-26 22:02:36 +00:00
---
- name: Rebuild service
ansible.builtin.command:
cmd: docker compose build --pull
chdir: "{{ service_path }}"
when:
- docker_rebuild
register: cmd_result
changed_when: true
- name: Build service
ansible.builtin.command:
cmd: docker compose build --pull
chdir: "{{ service_path }}"
when:
- "'local-dev' != inventory_hostname"
- docker_update is defined
- docker_update
register: cmd_result
changed_when: true
- name: Pull service
ansible.builtin.command:
cmd: docker compose pull --ignore-buildable
chdir: "{{ service_path }}"
when:
- "'local-dev' != inventory_hostname"
- docker_update is defined
- docker_update
register: cmd_result
changed_when: true
- name: Start service
ansible.builtin.command:
cmd: docker compose up -d {{ docker_force_recreate }}
chdir: "{{ service_path }}"
when: "'local-dev' != inventory_hostname"
register: cmd_result
changed_when: cmd_result.stderr | regex_search('Started$')