Files
pet-project-server/playbook-remove-user-and-app.yml
T
av 564432755d Ansible: точечные фиксы идемпотентности
- backup-targets собирается одной copy вместо lineinfile в цикле: теперь
  удаление цели из списка реально убирает строку из файла (7 плейбуков)
- netdata: getent вместо grep по /etc/group, ушёл бессмысленный changed_when
  и мёртвый фолбэк PGID
- исправлены копипастные имена play в wanderer и remove-user-and-app
2026-07-24 21:26:39 +03:00

34 lines
774 B
YAML

---
- name: "Remove user and application"
hosts: all
vars:
user_name: "<put-name-here>"
tasks:
- name: 'Remove user "{{ user_name }}"'
ansible.builtin.user:
name: "{{ user_name }}"
state: absent
remove: true
- name: 'Remove group "{{ user_name }}"'
ansible.builtin.group:
name: "{{ user_name }}"
state: absent
- name: "Remove web dir"
ansible.builtin.file:
path: "/var/www/{{ user_name }}"
state: absent
- name: "Remove application dir"
ansible.builtin.file:
path: "{{ (application_dir, user_name) | path_join }}"
state: absent
- name: "Remove home dir"
ansible.builtin.file:
path: "/home/{{ user_name }}"
state: absent