44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
---
|
|
- name: Prune Docker system before starting services
|
|
ansible.builtin.command: docker system prune -f --all
|
|
register: prune_output
|
|
ignore_errors: yes
|
|
changed_when: false
|
|
|
|
- name: Debug - Show Docker prune output
|
|
ansible.builtin.debug:
|
|
var: prune_output
|
|
verbosity: 1
|
|
|
|
- name: Ensure services destination directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ server_services_dir }}"
|
|
state: directory
|
|
mode: '0755'
|
|
owner: "{{ ansible_user | default('root') }}"
|
|
group: "{{ ansible_user | default('root') }}"
|
|
|
|
- name: Copy service folder
|
|
ansible.builtin.copy:
|
|
src: "{{ source_services_dir }}/{{ item }}"
|
|
dest: "{{ server_services_dir }}"
|
|
mode: '0755'
|
|
owner: "{{ ansible_user | default('root') }}"
|
|
group: "{{ ansible_user | default('root') }}"
|
|
with_items: "{{ services }}"
|
|
|
|
- name: Docker Compose Start Service
|
|
community.docker.docker_compose_v2:
|
|
project_src: "{{ server_services_dir }}/{{ item }}"
|
|
# environment: "{{ compose_env }}"
|
|
check_files_existing: true
|
|
assume_yes: true
|
|
build: policy
|
|
wait: true
|
|
register: output
|
|
with_items: "{{ services }}"
|
|
async: 300
|
|
poll: 10
|
|
|
|
|