Bug 1787996
| Summary: | [ansible-freeipa] "action: hbacrule" is not working while adding members | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Varun Mylaraiah <mvarun> |
| Component: | ansible-freeipa | Assignee: | Thomas Woerner <twoerner> |
| Status: | CLOSED ERRATA | QA Contact: | ipa-qe <ipa-qe> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.2 | Flags: | pm-rhel:
mirror+
|
| Target Milestone: | rc | ||
| Target Release: | 8.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | ansible-freeipa-0.1.8-2.el8 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-04-28 16:01:57 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: | |||
Here is the upstream PR: https://github.com/freeipa/ansible-freeipa/pull/199
Verified
Manual execution console output:
================================
# rpm -q ansible-freeipa
ansible-freeipa-0.1.8-3.el8.noarch
[root@master ~]# ipa hbacrule-show myrule01
Rule name: myrule01
Enabled: TRUE
[root@ansible ~]# cat 996_01.yaml
---
- name: Playbook to ensure hbac rule is present with hbacsvc
hosts: ipaserver
become: true
tasks:
- ipahbacrule:
ipaadmin_password: <xxxxxxxx>
name: myrule01
hbacsvc: sudo,su
action: member
[root@ansible ~]# ansible-playbook -vv -i inventory/server.hosts 996_01.yaml
ansible-playbook 2.9.5
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.6.8 (default, Dec 5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Using /etc/ansible/ansible.cfg as config file
PLAYBOOK: 996_01.yaml ************************************************************************************************
1 plays in 996_01.yaml
PLAY [Playbook to ensure hbac rule is present with hbacsvc] **********************************************************
TASK [Gathering Facts] ***********************************************************************************************
task path: /root/996_01.yaml:2
ok: [master.ipadomain.test]
META: ran handlers
TASK [ipahbacrule] ***************************************************************************************************
task path: /root/996_01.yaml:7
changed: [master.ipadomain.test] => {"changed": true}
META: ran handlers
META: ran handlers
PLAY RECAP ***********************************************************************************************************
master.ipadomain.test : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@ansible ~]# cat 996_02.yaml
---
- name: Playbook to ensure hbac rule is present with hbacsvc
hosts: ipaserver
become: true
tasks:
- ipahbacrule:
ipaadmin_password: <xxxxxxxx>
name: myrule01
user: hbacuser01
group: hbacgroup01
action: hbacrule
state: present
[root@ansible ~]# ansible-playbook -vv -i inventory/server.hosts 996_02.yaml
ansible-playbook 2.9.5
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.6.8 (default, Dec 5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Using /etc/ansible/ansible.cfg as config file
PLAYBOOK: 996_02.yaml ************************************************************************************************
1 plays in 996_02.yaml
PLAY [Playbook to ensure hbac rule is present with hbacsvc] **********************************************************
TASK [Gathering Facts] ***********************************************************************************************
task path: /root/996_02.yaml:2
ok: [master.ipadomain.test]
META: ran handlers
TASK [ipahbacrule] ***************************************************************************************************
task path: /root/996_02.yaml:7
changed: [master.ipadomain.test] => {"changed": true}
META: ran handlers
META: ran handlers
PLAY RECAP ***********************************************************************************************************
master.ipadomain.test : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@master ~]# ipa hbacrule-show myrule01
Rule name: myrule01
Enabled: TRUE
Users: hbacuser01
User Groups: hbacgroup01
[root@master ~]#
Automated test console output: =============================== 2020-03-04T11:17:50 ansible_freeipa_tests/hbac_module.py::Testhbacrule01_02_03::test_add_hbacrule 2020-03-04T11:17:50 [1m-------------------------------- live log call ---------------------------------[0m 2020-03-04T11:17:50 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['ipactl', 'status'] 2020-03-04T11:17:53 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kinit', 'admin'] 2020-03-04T11:17:53 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['ipa', 'hbacrule-find'] 2020-03-04T11:17:55 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kdestroy', '-A'] 2020-03-04T11:17:55 [pytest_multihost.host.Host.ansible.ParamikoTransport] [32mINFO[0m WRITE inventory/hbac.hosts 2020-03-04T11:17:55 [pytest_multihost.host.Host.ansible.ParamikoTransport] [32mINFO[0m PUT hbac_module.yml 2020-03-04T11:17:55 [pytest_multihost.host.Host.ansible.ParamikoTransport] [32mINFO[0m RUN ['ansible-playbook', '--ssh-extra-args="-o StrictHostKeyChecking=no"', '-vv', '-i', 'inventory/hbac.hosts', 'hbac_module.yml'] 2020-03-04T11:18:01 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kinit', 'admin'] 2020-03-04T11:18:01 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['ipa', 'hbacrule-find'] 2020-03-04T11:18:03 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kdestroy', '-A'] 2020-03-04T11:18:03 [32mPASSED[0m[36m [ 66%][0m 2020-03-04T11:18:03 ansible_freeipa_tests/hbac_module.py::Testhbacrule01_02_03::test_update_hbacrule_with_svc_member 2020-03-04T11:18:03 [1m-------------------------------- live log call ---------------------------------[0m 2020-03-04T11:18:03 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kinit', 'admin'] 2020-03-04T11:18:03 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['ipa', 'hbacrule-find'] 2020-03-04T11:18:04 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kdestroy', '-A'] 2020-03-04T11:18:04 [pytest_multihost.host.Host.ansible.ParamikoTransport] [32mINFO[0m WRITE inventory/hbac.hosts 2020-03-04T11:18:04 [pytest_multihost.host.Host.ansible.ParamikoTransport] [32mINFO[0m PUT hbac_module.yml 2020-03-04T11:18:04 [pytest_multihost.host.Host.ansible.ParamikoTransport] [32mINFO[0m RUN ['ansible-playbook', '--ssh-extra-args="-o StrictHostKeyChecking=no"', '-vv', '-i', 'inventory/hbac.hosts', 'hbac_module.yml'] 2020-03-04T11:18:11 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kinit', 'admin'] 2020-03-04T11:18:11 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['ipa', 'hbacrule-show', 'Newlogin_rule1'] 2020-03-04T11:18:12 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kdestroy', '-A'] 2020-03-04T11:18:12 [32mPASSED[0m[36m [ 83%][0m 2020-03-04T11:18:12 ansible_freeipa_tests/hbac_module.py::Testhbacrule01_02_03::test_update_hbacrule_with_user_usergroup_only 2020-03-04T11:18:12 [1m-------------------------------- live log call ---------------------------------[0m 2020-03-04T11:18:12 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kinit', 'admin'] 2020-03-04T11:18:12 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['ipa', 'hbacrule-find'] 2020-03-04T11:18:14 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kdestroy', '-A'] 2020-03-04T11:18:14 [pytest_multihost.host.Host.ansible.ParamikoTransport] [32mINFO[0m WRITE inventory/hbac.hosts 2020-03-04T11:18:14 [pytest_multihost.host.Host.ansible.ParamikoTransport] [32mINFO[0m PUT hbac_module.yml 2020-03-04T11:18:14 [pytest_multihost.host.Host.ansible.ParamikoTransport] [32mINFO[0m RUN ['ansible-playbook', '--ssh-extra-args="-o StrictHostKeyChecking=no"', '-vv', '-i', 'inventory/hbac.hosts', 'hbac_module.yml'] 2020-03-04T11:18:21 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kinit', 'admin'] 2020-03-04T11:18:21 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['ipa', 'hbacrule-show', 'Newlogin_rule1'] 2020-03-04T11:18:23 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kdestroy', '-A'] 2020-03-04T11:18:23 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kinit', 'admin'] 2020-03-04T11:18:23 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['ipa', 'hbacrule-show', 'Newlogin_rule1'] 2020-03-04T11:18:24 [pytest_multihost.host.Host.master.ParamikoTransport] [32mINFO[0m RUN ['kdestroy', '-A'] 2020-03-04T11:18:24 [32mPASSED[0m[36m [100%][0m 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, 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-2020:1705 |
Description of problem: Not able to replace the members from hbac rule with "action: hbacrule" Version-Release number of selected component (if applicable): ansible-freeipa-0.1.8-1.el8.noarch ipa-server-4.8.4-2.module+el8.2.0+5265+c70de5c4.x86_64 Steps to Reproduce: Before running playbook ################################### Console output from master: [root@master ~]# ipa hbacrule-show hbacrule1 Rule name: hbacrule1 Enabled: TRUE Users: testuser01, testuser02 User Groups: group_test01, group_test02 Services: su,sudo Service Groups: login1, login_group [root@ansible ~]# cat hbac02.yaml --- - name: Playbook to handle hbacrules hosts: ipaserver become: true tasks: - ipahbacrule: ipaadmin_password: <xxxxxx> name: hbacrule1 - ipahbacrule: ipaadmin_password: <xxxxxx> name: hbacrule1 user: testuser03,testuser04 group: group_test03 action: hbacrule state: present [root@ansible ~]# ansible-playbook -vv -i inventory/server.hosts hbac02.yaml ansible-playbook 2.9.2 config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.6/site-packages/ansible executable location = /usr/bin/ansible-playbook python version = 3.6.8 (default, Dec 5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] Using /etc/ansible/ansible.cfg as config file PLAYBOOK: hbac02.yaml *********************************************************************************************************************** 1 plays in hbac02.yaml PLAY [Playbook to handle hbacrules] ********************************************************************************************************* TASK [Gathering Facts] ********************************************************************************************************************** task path: /root/hbac02.yaml:2 ok: [master.ipadomain.test] META: ran handlers TASK [ipahbacrule] ************************************************************************************************************************** task path: /root/hbac02.yaml:7 ok: [master.ipadomain.test] => {"changed": false} TASK [ipahbacrule] ************************************************************************************************************************** task path: /root/hbac02.yaml:11 changed: [master.ipadomain.test] => {"changed": true} META: ran handlers META: ran handlers PLAY RECAP ********************************************************************************************************************************** master.ipadomain.test : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 After running playbook ################################### Console output from master: [root@master ~]# ipa hbacrule-show hbacrule1 Rule name: hbacrule1 Enabled: TRUE Users: testuser01, testuser02, testuser04, testuser03 User Groups: group_test01, group_test02, group_test03 Services: su,sudo Service Groups: login1, login_group Actual results: Updating user and user-group with existing members. Expected results: Should replace existing members with new members when "action: hbacrule" used.