Files
ansible/roles/coolify/tasks/main.yaml
T

69 lines
1.8 KiB
YAML

---
- name: Validate coolify_state parameter
ansible.builtin.assert:
that:
- coolify_state in ['present', 'absent', 'latest', 'stopped']
msg: "coolify_state must be one of: present, absent, latest, stopped"
tags: always
- name: Detect Coolify installation status
ansible.builtin.include_tasks: detect.yaml
tags: always
- name: Ensure Docker network exists
become: true
community.docker.docker_network:
name: "{{ coolify_docker_network }}"
driver: bridge
attachable: true
state: present
tags: coolify, docker, installation
- name: Uninstall Coolify
ansible.builtin.include_tasks: delete.yaml
when: coolify_state == 'absent'
tags: coolify, deletion
- name: Install Coolify
ansible.builtin.include_tasks: install.yaml
when:
- coolify_state in ['present', 'latest']
- not coolify_installed.stat.exists
tags: coolify, installation
- name: Update Coolify
ansible.builtin.include_tasks: update.yaml
when:
- coolify_state == 'latest'
- coolify_installed.stat.exists
tags: coolify, update
- name: Ensure Configuration
ansible.builtin.include_tasks: configure.yaml
when:
- coolify_state == 'present'
- coolify_installed.stat.exists
tags: coolify, configuration
- name: Ensure Started
ansible.builtin.include_tasks: start.yaml
when:
- coolify_state == 'present'
- coolify_installed.stat.exists
tags: coolify, start
- name: Stop Coolify
ansible.builtin.include_tasks: stop.yaml
when:
- coolify_state == 'stopped'
- coolify_installed.stat.exists
tags: coolify, stop
- name: Show status
ansible.builtin.debug:
msg:
- "Coolify State: {{ coolify_state }}"
- "URL: http://{{ ansible_host }}:{{ coolify_http_port }}"
when: coolify_state in ['present', 'latest']
tags: coolify, status