refactor(roles/dokploy): refactored dokploy role

This commit is contained in:
ITQ
2026-03-19 14:42:11 +03:00
parent 81b623432c
commit b514c04305
4 changed files with 53 additions and 22 deletions
+21 -5
View File
@@ -9,14 +9,22 @@
- dokploy
- dokploy-redis
- dokploy-postgres
ignore_errors: true
register: _dokploy_remove_services
failed_when:
- _dokploy_remove_services is failed
- "'could not find' not in (_dokploy_remove_services.msg | default('') | lower)"
- "'not found' not in (_dokploy_remove_services.msg | default('') | lower)"
tags: dokploy, deletion
- name: Leave Docker Swarm
become: true
community.docker.docker_swarm:
state: absent
ignore_errors: true
register: _dokploy_swarm_leave
failed_when:
- _dokploy_swarm_leave is failed
- "'not part of a swarm' not in (_dokploy_swarm_leave.msg | default('') | lower)"
- "'not a swarm manager' not in (_dokploy_swarm_leave.msg | default('') | lower)"
tags: dokploy, deletion
- name: Remove Dokploy network
@@ -24,10 +32,14 @@
community.docker.docker_network:
name: "{{ dokploy_docker_network }}"
state: absent
ignore_errors: true
register: _dokploy_remove_network
failed_when:
- _dokploy_remove_network is failed
- "'not found' not in (_dokploy_remove_network.msg | default('') | lower)"
tags: dokploy, deletion
- name: Remove Dokploy configuration directory
become: true
ansible.builtin.file:
path: "{{ dokploy_config_dir }}"
state: absent
@@ -43,13 +55,17 @@
- dokploy-postgres-database
- redis-data-volume
- dokploy-docker-config
register: _dokploy_remove_volumes
failed_when:
- _dokploy_remove_volumes is failed
- "'no such volume' not in (_dokploy_remove_volumes.msg | default('') | lower)"
- "'not found' not in (_dokploy_remove_volumes.msg | default('') | lower)"
when: dokploy_remove_data_on_absent | bool
ignore_errors: true
tags: dokploy, deletion, volumes
- name: Display uninstallation message
ansible.builtin.debug:
msg:
- "Dokploy has been uninstalled"
- "Application data preserved: {{ not dokploy_remove_data_on_absent }}"
- "Data removed: {{ dokploy_remove_data_on_absent | bool }}"
tags: dokploy, deletion