Files
ouranos/ansible/casdoor/remove.yml
Robert Helewka 042df52bca Refactor user management in Ansible playbooks to standardize on keeper_user
- Updated user addition tasks across multiple playbooks (mcp_switchboard, mcpo, neo4j, neo4j_mcp, openwebui, postgresql, rabbitmq, searxng, smtp4dev) to replace references to ansible_user and remote_user with keeper_user.
- Modified PostgreSQL deployment to create directories and manage files under keeper_user's home.
- Enhanced documentation to clarify account taxonomy and usage of keeper_user in playbooks.
- Introduced new deployment for Agent S, including environment setup, desktop environment installation, XRDP configuration, and accessibility support.
- Added staging playbook for preparing release tarballs from local repositories.
- Created templates for XRDP configuration and environment activation scripts.
- Removed obsolete sunwait documentation.
2026-03-05 10:37:41 +00:00

76 lines
2.5 KiB
YAML

---
# -----------------------------------------------------------------------------
# Casdoor Removal Playbook
# -----------------------------------------------------------------------------
# Removes Casdoor SSO including:
# - Docker containers and volumes
# - Configuration files
# - PostgreSQL data directory
# - Service user and group
#
# WARNING: This will permanently delete all Casdoor data including the database!
# -----------------------------------------------------------------------------
- name: Remove Casdoor
hosts: ubuntu
tasks:
- name: Check if host has casdoor service
ansible.builtin.set_fact:
has_casdoor_service: "{{ 'casdoor' in services | default([]) }}"
- name: Skip hosts without casdoor service
ansible.builtin.meta: end_host
when: not has_casdoor_service
# -------------------------------------------------------------------------
# Stop and Remove Docker Services
# -------------------------------------------------------------------------
- name: Check if docker-compose.yml exists
become: true
ansible.builtin.stat:
path: "{{ casdoor_directory }}/docker-compose.yml"
register: compose_file
- name: Stop and remove Casdoor containers
become: true
community.docker.docker_compose_v2:
project_src: "{{ casdoor_directory }}"
state: absent
remove_volumes: true
when: compose_file.stat.exists
# -------------------------------------------------------------------------
# Remove Data Directory
# -------------------------------------------------------------------------
- name: Remove casdoor directory and all data
become: true
ansible.builtin.file:
path: "{{ casdoor_directory }}"
state: absent
# -------------------------------------------------------------------------
# Remove User and Group
# -------------------------------------------------------------------------
- name: Remove keeper_user from casdoor group
become: true
ansible.builtin.command:
cmd: gpasswd -d {{ keeper_user }} {{ casdoor_group }}
register: gpasswd_result
changed_when: gpasswd_result.rc == 0
failed_when: false
- name: Remove casdoor user
become: true
ansible.builtin.user:
name: "{{ casdoor_user }}"
state: absent
- name: Remove casdoor group
become: true
ansible.builtin.group:
name: "{{ casdoor_group }}"
state: absent