Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1999916

Summary: [ansible-freeipa] automember remove orphans group/hostgroup is missing from the automember module.
Product: Red Hat Enterprise Linux 8 Reporter: Varun Mylaraiah <mvarun>
Component: ansible-freeipaAssignee: Thomas Woerner <twoerner>
Status: CLOSED ERRATA QA Contact: ipa-qe <ipa-qe>
Severity: medium Docs Contact:
Priority: high    
Version: 8.5CC: rjeffman
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ansible-freeipa-1.5.3-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2021955 (view as bug list) Environment:
Last Closed: 2022-05-10 13:38:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2021955    

Description Varun Mylaraiah 2021-09-01 02:34:50 UTC
Description of problem:
In the Ansible-freeipa Automember module, There is no option to remove an orphans group/hostgroup. 

Version-Release number of selected component (if applicable):
ansible-freeipa-0.3.8-1


Expected results:
CLI option.
# ipa automember-find-orphans --help
Usage: ipa [global-options] automember-find-orphans [CRITERIA] [options]

Search for orphan automember rules. The command might need to be run as
    a privileged user to get all orphan rules.
Options:
 --desc=STR            A description of this auto member rule
 --type=['group', 'hostgroup'] Grouping to which the rule applies
 --remove              Remove orphan automember rules

Comment 6 Varun Mylaraiah 2022-01-13 16:01:07 UTC
Verified
ansible-freeipa-1.5.3-1.el8

2022-01-13T12:37:30 ansible_freeipa_tests/automember/test_automember.py::TestAutomember::test_automember_remove_orphan_group_rule PASSED [ 97%]
2022-01-13T12:37:40 ansible_freeipa_tests/automember/test_automember.py::TestAutomember::test_automember_remove_orphan_hostgroup_rule PASSED [100%]

Console-Output
===============

ansible_freeipa_tests/automember/test_automember.py::TestAutomember::test_automember_remove_orphan_group_rule


2022-01-13T12:37:22+0000 [pytest_multihost.host.Host.master.ParamikoTransport] INFO RUN ['ipa', 'automember-add', '--type=group', 'testorphangroup']
2022-01-13T12:37:22+0000 [pytest_multihost.host.Host.master.cmd234] DEBUG RUN ['ipa', 'automember-add', '--type=group', 'testorphangroup']
2022-01-13T12:37:22+0000 [paramiko.transport] DEBUG [chan 233] Sesch channel 233 request ok
2022-01-13T12:37:22+0000 [pytest_multihost.host.Host.master.cmd234] DEBUG -bash: line 1: cd: /root/multihost_tests: No such file or directory
2022-01-13T12:37:22+0000 [pytest_multihost.host.Host.master.cmd234] DEBUG -bash: line 2: /root/multihost_tests/env.sh: No such file or directory
2022-01-13T12:37:23+0000 [pytest_multihost.host.Host.master.cmd234] DEBUG ---------------------------------------
2022-01-13T12:37:23+0000 [pytest_multihost.host.Host.master.cmd234] DEBUG Added automember rule "testorphangroup"
2022-01-13T12:37:23+0000 [pytest_multihost.host.Host.master.cmd234] DEBUG ---------------------------------------
2022-01-13T12:37:23+0000 [pytest_multihost.host.Host.master.cmd234] DEBUG   Automember Rule: testorphangroup
2022-01-13T12:37:23+0000 [paramiko.transport] DEBUG [chan 233] EOF received (233)
2022-01-13T12:37:23+0000 [paramiko.transport] DEBUG [chan 233] EOF sent (233)
2022-01-13T12:37:23+0000 [pytest_multihost.host.Host.master.cmd234] DEBUG Exit code: 0
2022-01-13T12:37:23+0000 [paramiko.transport] DEBUG [chan 234] Max packet in: 32768 bytes
2022-01-13T12:37:23+0000 [paramiko.transport] DEBUG [chan 234] Max packet out: 32768 bytes
2022-01-13T12:37:23+0000 [paramiko.transport] DEBUG Secsh channel 234 opened.
2022-01-13T12:37:23+0000 [pytest_multihost.host.Host.master.ParamikoTransport] INFO RUN ['ipa', 'group-del', 'testorphangroup']
2022-01-13T12:37:23+0000 [pytest_multihost.host.Host.master.cmd235] DEBUG RUN ['ipa', 'group-del', 'testorphangroup']
2022-01-13T12:37:23+0000 [paramiko.transport] DEBUG [chan 234] Sesch channel 234 request ok
2022-01-13T12:37:23+0000 [pytest_multihost.host.Host.master.cmd235] DEBUG -bash: line 1: cd: /root/multihost_tests: No such file or directory
2022-01-13T12:37:23+0000 [pytest_multihost.host.Host.master.cmd235] DEBUG -bash: line 2: /root/multihost_tests/env.sh: No such file or directory
2022-01-13T12:37:23+0000 [pytest_multihost.host.Host.master.cmd235] DEBUG -------------------------------
2022-01-13T12:37:23+0000 [pytest_multihost.host.Host.master.cmd235] DEBUG Deleted group "testorphangroup"
2022-01-13T12:37:23+0000 [pytest_multihost.host.Host.master.cmd235] DEBUG -------------------------------
2022-01-13T12:37:24+0000 [paramiko.transport] DEBUG [chan 234] EOF received (234)
2022-01-13T12:37:24+0000 [paramiko.transport] DEBUG [chan 234] EOF sent (234)
2022-01-13T12:37:24+0000 [pytest_multihost.host.Host.master.cmd235] DEBUG Exit code: 0
2022-01-13T12:37:24+0000 [paramiko.transport] DEBUG [chan 235] Max packet in: 32768 bytes
2022-01-13T12:37:24+0000 [paramiko.transport] DEBUG [chan 235] Max packet out: 32768 bytes
2022-01-13T12:37:24+0000 [paramiko.transport] DEBUG Secsh channel 235 opened.
2022-01-13T12:37:24+0000 [pytest_multihost.host.Host.master.ParamikoTransport] INFO RUN ['kinit', 'admin']
2022-01-13T12:37:24+0000 [pytest_multihost.host.Host.master.cmd236] DEBUG RUN ['kinit', 'admin']
2022-01-13T12:37:24+0000 [paramiko.transport] DEBUG [chan 235] Sesch channel 235 request ok
2022-01-13T12:37:24+0000 [pytest_multihost.host.Host.master.cmd236] DEBUG -bash: line 1: cd: /root/multihost_tests: No such file or directory
2022-01-13T12:37:24+0000 [pytest_multihost.host.Host.master.cmd236] DEBUG -bash: line 2: /root/multihost_tests/env.sh: No such file or directory
2022-01-13T12:37:24+0000 [pytest_multihost.host.Host.master.cmd236] DEBUG Password for admin: 
2022-01-13T12:37:24+0000 [paramiko.transport] DEBUG [chan 235] EOF received (235)
2022-01-13T12:37:24+0000 [paramiko.transport] DEBUG [chan 235] EOF sent (235)
2022-01-13T12:37:24+0000 [pytest_multihost.host.Host.master.cmd236] DEBUG Exit code: 0
2022-01-13T12:37:24+0000 [paramiko.transport] DEBUG [chan 236] Max packet in: 32768 bytes
2022-01-13T12:37:24+0000 [paramiko.transport] DEBUG [chan 236] Max packet out: 32768 bytes
2022-01-13T12:37:24+0000 [paramiko.transport] DEBUG Secsh channel 236 opened.
2022-01-13T12:37:24+0000 [pytest_multihost.host.Host.master.ParamikoTransport] INFO RUN ['ipa', 'automember-find-orphans', '--type=group']
2022-01-13T12:37:24+0000 [pytest_multihost.host.Host.master.cmd237] DEBUG RUN ['ipa', 'automember-find-orphans', '--type=group']
2022-01-13T12:37:24+0000 [paramiko.transport] DEBUG [chan 236] Sesch channel 236 request ok
2022-01-13T12:37:24+0000 [pytest_multihost.host.Host.master.cmd237] DEBUG -bash: line 1: cd: /root/multihost_tests: No such file or directory
2022-01-13T12:37:24+0000 [pytest_multihost.host.Host.master.cmd237] DEBUG -bash: line 2: /root/multihost_tests/env.sh: No such file or directory
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.cmd237] DEBUG ---------------
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.cmd237] DEBUG 1 rules matched
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.cmd237] DEBUG ---------------
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.cmd237] DEBUG   Automember Rule: testorphangroup
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.cmd237] DEBUG ----------------------------
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.cmd237] DEBUG Number of entries returned 1
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.cmd237] DEBUG ----------------------------
2022-01-13T12:37:25+0000 [paramiko.transport] DEBUG [chan 236] EOF received (236)
2022-01-13T12:37:25+0000 [paramiko.transport] DEBUG [chan 236] EOF sent (236)
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.cmd237] DEBUG Exit code: 0
2022-01-13T12:37:25+0000 [paramiko.transport] DEBUG [chan 237] Max packet in: 32768 bytes
2022-01-13T12:37:25+0000 [paramiko.transport] DEBUG [chan 237] Max packet out: 32768 bytes
2022-01-13T12:37:25+0000 [paramiko.transport] DEBUG Secsh channel 237 opened.
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.ParamikoTransport] INFO RUN ['kdestroy', '-A']
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.cmd238] DEBUG RUN ['kdestroy', '-A']
2022-01-13T12:37:25+0000 [paramiko.transport] DEBUG [chan 237] Sesch channel 237 request ok
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.cmd238] DEBUG -bash: line 1: cd: /root/multihost_tests: No such file or directory
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.cmd238] DEBUG -bash: line 2: /root/multihost_tests/env.sh: No such file or directory
2022-01-13T12:37:25+0000 [paramiko.transport] DEBUG [chan 237] EOF received (237)
2022-01-13T12:37:25+0000 [paramiko.transport] DEBUG [chan 237] EOF sent (237)
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.master.cmd238] DEBUG Exit code: 0
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.ParamikoTransport] INFO WRITE inventory/automember.hosts
2022-01-13T12:37:25+0000 [paramiko.transport.sftp] DEBUG [chan 0] open(b'inventory/automember.hosts', 'wb')
2022-01-13T12:37:25+0000 [paramiko.transport.sftp] DEBUG [chan 0] open(b'inventory/automember.hosts', 'wb') -> 00000000
2022-01-13T12:37:25+0000 [paramiko.transport.sftp] DEBUG [chan 0] close(00000000)
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.ParamikoTransport] INFO PUT automember_module.yml
2022-01-13T12:37:25+0000 [paramiko.transport.sftp] DEBUG [chan 0] open(b'automember_module.yml', 'wb')
2022-01-13T12:37:25+0000 [paramiko.transport.sftp] DEBUG [chan 0] open(b'automember_module.yml', 'wb') -> 00000000
2022-01-13T12:37:25+0000 [paramiko.transport.sftp] DEBUG [chan 0] close(00000000)
2022-01-13T12:37:25+0000 [paramiko.transport.sftp] DEBUG [chan 0] stat(b'automember_module.yml')
2022-01-13T12:37:25+0000 [paramiko.transport] DEBUG [chan 40] Max packet in: 32768 bytes
2022-01-13T12:37:25+0000 [paramiko.transport] DEBUG [chan 40] Max packet out: 32768 bytes
2022-01-13T12:37:25+0000 [paramiko.transport] DEBUG Secsh channel 40 opened.
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.ParamikoTransport] INFO RUN ['ansible-playbook', '--ssh-extra-args="-o StrictHostKeyChecking=no"', '-vv', '-i', 'inventory/automember.hosts', 'automember_module.yml']
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG RUN ['ansible-playbook', '--ssh-extra-args="-o StrictHostKeyChecking=no"', '-vv', '-i', 'inventory/automember.hosts', 'automember_module.yml']
2022-01-13T12:37:25+0000 [paramiko.transport] DEBUG [chan 40] Sesch channel 40 request ok
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG -bash: line 1: cd: /root/multihost_tests: No such file or directory
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG -bash: line 2: /root/multihost_tests/env.sh: No such file or directory
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG ansible-playbook [core 2.12.1]
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG   config file = /etc/ansible/ansible.cfg
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG   configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG   ansible python module location = /usr/lib/python3.8/site-packages/ansible
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG   ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG   executable location = /usr/bin/ansible-playbook
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG   python version = 3.8.12 (default, Sep 16 2021, 10:46:05) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG   jinja version = 2.10.3
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG   libyaml = True
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG Using /etc/ansible/ansible.cfg as config file
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG Skipping callback 'default', as we already have a stdout callback.
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG Skipping callback 'minimal', as we already have a stdout callback.
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG Skipping callback 'oneline', as we already have a stdout callback.
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG 
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG PLAYBOOK: automember_module.yml ************************************************
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG 1 plays in automember_module.yml
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG 
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG PLAY [Playbook to ensure a all orphan automember group rules are removed] ******
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG 
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG TASK [Gathering Facts] *********************************************************
2022-01-13T12:37:25+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG task path: /root/automember_module.yml:2
2022-01-13T12:37:26+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG ok: [master.ipadomain.test]
2022-01-13T12:37:26+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG META: ran handlers
2022-01-13T12:37:26+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG 
2022-01-13T12:37:26+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG TASK [ipaautomember] ***********************************************************
2022-01-13T12:37:26+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG task path: /root/automember_module.yml:7
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG changed: [master.ipadomain.test] => {"changed": true}
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG META: ran handlers
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG META: ran handlers
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG 
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG PLAY RECAP *********************************************************************
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG master.ipadomain.test      : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG 
2022-01-13T12:37:29+0000 [paramiko.transport] DEBUG [chan 40] EOF received (40)
2022-01-13T12:37:29+0000 [paramiko.transport] DEBUG [chan 40] EOF sent (40)
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.ansible.cmd40] DEBUG Exit code: 0
2022-01-13T12:37:29+0000 [paramiko.transport] DEBUG [chan 238] Max packet in: 32768 bytes
2022-01-13T12:37:29+0000 [paramiko.transport] DEBUG [chan 238] Max packet out: 32768 bytes
2022-01-13T12:37:29+0000 [paramiko.transport] DEBUG Secsh channel 238 opened.
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.master.ParamikoTransport] INFO RUN ['kinit', 'admin']
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.master.cmd239] DEBUG RUN ['kinit', 'admin']
2022-01-13T12:37:29+0000 [paramiko.transport] DEBUG [chan 238] Sesch channel 238 request ok
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.master.cmd239] DEBUG -bash: line 1: cd: /root/multihost_tests: No such file or directory
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.master.cmd239] DEBUG -bash: line 2: /root/multihost_tests/env.sh: No such file or directory
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.master.cmd239] DEBUG Password for admin: 
2022-01-13T12:37:29+0000 [paramiko.transport] DEBUG [chan 238] EOF received (238)
2022-01-13T12:37:29+0000 [paramiko.transport] DEBUG [chan 238] EOF sent (238)
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.master.cmd239] DEBUG Exit code: 0
2022-01-13T12:37:29+0000 [paramiko.transport] DEBUG [chan 239] Max packet in: 32768 bytes
2022-01-13T12:37:29+0000 [paramiko.transport] DEBUG [chan 239] Max packet out: 32768 bytes
2022-01-13T12:37:29+0000 [paramiko.transport] DEBUG Secsh channel 239 opened.
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.master.ParamikoTransport] INFO RUN ['ipa', 'automember-find-orphans', '--type=group']
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.master.cmd240] DEBUG RUN ['ipa', 'automember-find-orphans', '--type=group']
2022-01-13T12:37:29+0000 [paramiko.transport] DEBUG [chan 239] Sesch channel 239 request ok
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.master.cmd240] DEBUG -bash: line 1: cd: /root/multihost_tests: No such file or directory
2022-01-13T12:37:29+0000 [pytest_multihost.host.Host.master.cmd240] DEBUG -bash: line 2: /root/multihost_tests/env.sh: No such file or directory
2022-01-13T12:37:30+0000 [pytest_multihost.host.Host.master.cmd240] DEBUG ---------------
2022-01-13T12:37:30+0000 [pytest_multihost.host.Host.master.cmd240] DEBUG 0 rules matched
2022-01-13T12:37:30+0000 [pytest_multihost.host.Host.master.cmd240] DEBUG ---------------
2022-01-13T12:37:30+0000 [pytest_multihost.host.Host.master.cmd240] DEBUG ----------------------------
2022-01-13T12:37:30+0000 [pytest_multihost.host.Host.master.cmd240] DEBUG Number of entries returned 0
2022-01-13T12:37:30+0000 [pytest_multihost.host.Host.master.cmd240] DEBUG ----------------------------

Comment 10 errata-xmlrpc 2022-05-10 13:38:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (ansible-freeipa bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:1791