chore(coolify): refactored cooliy role

This commit is contained in:
ITQ
2026-02-20 18:59:51 +03:00
parent a5a6a1f038
commit 3303156b0a
5 changed files with 104 additions and 93 deletions
+11 -48
View File
@@ -22,7 +22,7 @@
state: directory
owner: "{{ coolify_owner }}"
group: "{{ coolify_group }}"
mode: '0750'
mode: "0750"
loop:
- "{{ coolify_base_dir }}/source"
- "{{ coolify_base_dir }}/ssh/keys"
@@ -39,68 +39,31 @@
ansible.builtin.get_url:
url: "https://cdn.coollabs.io/coolify/{{ item.file }}"
dest: "{{ coolify_base_dir }}/source/{{ item.dest }}"
mode: '0644'
mode: "0644"
owner: "{{ coolify_owner }}"
group: "{{ coolify_group }}"
loop:
- { file: "docker-compose.yml", dest: "docker-compose.yml" }
- { file: "docker-compose.prod.yml", dest: "docker-compose.prod.yml" }
- { file: "upgrade.sh", dest: "upgrade.sh" }
tags: coolify, files, installation
- name: Ensure .env exists from template (only when missing)
ansible.builtin.stat:
path: "{{ coolify_base_dir }}/source/.env"
register: env_file_check
tags: coolify, files, installation
- name: Create .env from template when missing
ansible.builtin.template:
src: "templates/.env.production.j2"
dest: "{{ coolify_base_dir }}/source/.env"
mode: '0640'
when: not env_file_check.stat.exists
tags: coolify, files, installation
- name: Configure Coolify environment
ansible.builtin.include_tasks: configure.yaml
tags: coolify, configuration, installation
- name: Ensure correct ownership and permissions recursively
ansible.builtin.file:
path: "{{ coolify_base_dir }}"
owner: "{{ coolify_owner }}"
group: "{{ coolify_group }}"
mode: '0750'
mode: "0750"
recurse: true
tags: coolify, permissions, installation
- 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: Start Coolify services
become: true
community.docker.docker_compose_v2:
project_src: "{{ coolify_base_dir }}/source"
files: "{{ coolify_compose_files }}"
pull: always
state: present
wait: true
wait_timeout: 300
tags: coolify, docker, installation
- name: Wait for Coolify HTTP to respond
ansible.builtin.uri:
url: "http://localhost:{{ coolify_http_port }}"
method: GET
status_code: 200
timeout: 30
body_format: json
register: coolify_health
until: coolify_health.status == 200
retries: 10
delay: 10
tags: coolify, health, installation
- name: Start Coolify
ansible.builtin.include_tasks: start.yaml
tags: coolify, start, installation
- name: Show installed message
ansible.builtin.debug: