diff --git a/ansible/playbook.yml b/ansible/playbook.yml index f6e0646..f7d7f82 100644 --- a/ansible/playbook.yml +++ b/ansible/playbook.yml @@ -6,3 +6,4 @@ - role: studio.ansible.base - role: studio.ansible.users - role: studio.ansible.security + - role: dokploy diff --git a/ansible/roles/dokploy/defaults/main.yml b/ansible/roles/dokploy/defaults/main.yml new file mode 100644 index 0000000..cd622d8 --- /dev/null +++ b/ansible/roles/dokploy/defaults/main.yml @@ -0,0 +1,14 @@ +--- +# Official Dokploy installer +dokploy_installer_url: "https://dokploy.com/install.sh" +dokploy_installer_path: "/usr/local/bin/dokploy-install.sh" + +# Pin to a specific release tag for reproducible installs +dokploy_version: "latest" + +# Packages the installer expects on a minimal Debian image +# dokploy_prerequisites: +# - ca-certificates +# - curl +# - openssl +# - iproute2 diff --git a/ansible/roles/dokploy/tasks/main.yml b/ansible/roles/dokploy/tasks/main.yml new file mode 100644 index 0000000..36a39ae --- /dev/null +++ b/ansible/roles/dokploy/tasks/main.yml @@ -0,0 +1,33 @@ +--- +# - name: Install Dokploy prerequisites +# ansible.builtin.apt: +# name: "{{ dokploy_prerequisites }}" +# state: present +# update_cache: true + +- name: Download Dokploy installer + ansible.builtin.get_url: + url: "{{ dokploy_installer_url }}" + dest: "{{ dokploy_installer_path }}" + mode: "0755" + +# The upstream installer is not idempotent & exits non-zero if the swarm is already initialized. Guard on the presence of the dokploy swarm service +- name: Check if Dokploy is already installed + ansible.builtin.command: docker service inspect dokploy + register: dokploy_installed + changed_when: false + failed_when: false + +- name: Install Dokploy + ansible.builtin.command: "{{ dokploy_installer_path }}" + environment: + DOKPLOY_VERSION: "{{ dokploy_version }}" + changed_when: true + when: dokploy_installed.rc != 0 + +# - name: Update Dokploy (opt-in) +# ansible.builtin.command: "{{ dokploy_installer_path }} update" +# environment: +# DOKPLOY_VERSION: "{{ dokploy_version }}" +# changed_when: true +# when: dokploy_installed.rc == 0