--- - name: Configure VPS and Install Coolify hosts: coolify_vps become: true gather_facts: true tasks: - name: Wait for VPS to become reachable via SSH ansible.builtin.wait_for_connection: delay: 5 timeout: 300 - name: Update apt package cache ansible.builtin.apt: update_cache: yes cache_valid_time: 3600 - name: Install system prerequisites ansible.builtin.apt: name: - curl - git - ufw - jq state: present - name: Configure UFW firewall block: - name: Allow SSH traffic ansible.builtin.shell: ufw allow 22/tcp - name: Allow HTTP traffic ansible.builtin.shell: ufw allow 80/tcp - name: Allow HTTPS traffic ansible.builtin.shell: ufw allow 443/tcp - name: Allow Coolify Console traffic ansible.builtin.shell: ufw allow 8000/tcp - name: Allow Realtime/Websocket traffic ansible.builtin.shell: ufw allow 6001/tcp - name: Enable UFW firewall ansible.builtin.shell: echo "y" | ufw enable rescue: - name: Log firewall configuration failure ansible.builtin.debug: msg: "Failed to set up firewall, continuing with installation." - name: Check if Coolify is already installed ansible.builtin.stat: path: /data/coolify/source/.env register: coolify_installed - name: Install Coolify via official installation script ansible.builtin.shell: | curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash register: install_output when: not coolify_installed.stat.exists async: 600 poll: 10 - name: Print installation output ansible.builtin.debug: var: install_output.stdout_lines when: install_output.changed