redhat-cop / aap_utilities

Ansible Collection for automated deployment of AAP and other objects for general use
https://galaxy.ansible.com/infra/aap_utilities
GNU General Public License v3.0
81 stars 50 forks source link

The role infra.aap_utilities.aap_remove failed at the task `remove added users` #254

Open ducke opened 2 months ago

ducke commented 2 months ago

Summary

The role infra.aap_utilities.aap_remove failed at the task remove added users

Issue Type

Ansible, Collection, Docker/Podman details

ansible --version
ansible [core 2.16.3]
  config file = /home/xxx/ansible.cfg
  configured module search path = ['/home/xxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /home/xxx/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.3 (main, Jun 19 2024, 10:06:03) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22)] (/usr/bin/python3.12)
  jinja version = 3.1.2
  libyaml = True
ansible-galaxy collection list

# /home/xxx/.ansible/collections/ansible_collections
Collection          Version
------------------- -------
ansible.posix       1.5.4
community.crypto    2.16.0
community.general   8.0.2
infra.aap_utilities 2.5.2

OS / ENVIRONMENT

Desired Behavior

The role delete all users without error

Actual Behavior

image

After manual deleting the awx user with

sudo userdel -r -f awx

works the role as expected.

failed: [XXX] (item=awx) => {"ansible_loop_var": "item", "changed": false, "item": "awx", "msg": "userdel: user awx is currently used by process 972\n", "name": "awx", "rc": 8}
failed: [XXX] (item=awx) => {"ansible_loop_var": "item", "changed": false, "item": "awx", "msg": "userdel: user awx is currently used by process 974\n", "name": "awx", "rc": 8}
failed: [XXX] (item=awx) => {"ansible_loop_var": "item", "changed": false, "item": "awx", "msg": "userdel: user awx is currently used by process 81430\n", "name": "awx", "rc": 8}

The process was systemd.

STEPS TO REPRODUCE

---
- name: Playbook to configure ansible automation platform installation
  hosts: all
  tasks:
    - name: Include aap_setup_install role
      ansible.builtin.include_role:
        name: infra.aap_utilities.aap_setup_install
      when: inventory_hostname in groups["install_host"]

    - name: Include aap_setup_install role
      ansible.builtin.include_role:
        name: infra.aap_utilities.aap_setup_install