Bug 1822683
| Summary: | [ansible-freeipa] Not showing error while adding same user with multiple json files | ||
|---|---|---|---|
| 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 | CC: | rjeffman |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | 8.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | ansible-freeipa-0.1.12-4 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-11-04 02:46:35 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/310
Verified
ansible-freeipa-0.1.12-5.el8.noarch
Automation test result:
------------------------------ Captured log call -------------------------------
transport.py 329 INFO PUT /root/user_add.json
sftp.py 158 DEBUG [chan 0] open(b'/root/user_add.json', 'wb')
sftp.py 158 DEBUG [chan 0] open(b'/root/user_add.json', 'wb') -> 00000000
sftp.py 158 DEBUG [chan 0] close(00000000)
sftp.py 158 DEBUG [chan 0] stat(b'/root/user_add.json')
channel.py 1212 DEBUG [chan 111] Max packet in: 32768 bytes
channel.py 1212 DEBUG [chan 111] Max packet out: 32768 bytes
transport.py 1819 DEBUG Secsh channel 111 opened.
transport.py 318 INFO RUN ['kinit', 'admin']
transport.py 519 DEBUG RUN ['kinit', 'admin']
channel.py 1212 DEBUG [chan 111] Sesch channel 111 request ok
transport.py 563 DEBUG -bash: line 1: cd: /root/multihost_tests: No such file or directory
transport.py 563 DEBUG -bash: line 2: /root/multihost_tests/env.sh: No such file or directory
transport.py 563 DEBUG Password for admin:
channel.py 1212 DEBUG [chan 111] EOF received (111)
channel.py 1212 DEBUG [chan 111] EOF sent (111)
transport.py 217 DEBUG Exit code: 0
channel.py 1212 DEBUG [chan 112] Max packet in: 32768 bytes
channel.py 1212 DEBUG [chan 112] Max packet out: 32768 bytes
transport.py 1819 DEBUG Secsh channel 112 opened.
transport.py 318 INFO RUN ['ipa', 'user-find']
transport.py 519 DEBUG RUN ['ipa', 'user-find']
channel.py 1212 DEBUG [chan 112] Sesch channel 112 request ok
transport.py 563 DEBUG -bash: line 1: cd: /root/multihost_tests: No such file or directory
transport.py 563 DEBUG -bash: line 2: /root/multihost_tests/env.sh: No such file or directory
transport.py 563 DEBUG ----------------
transport.py 563 DEBUG 10 users matched
transport.py 563 DEBUG ----------------
transport.py 563 DEBUG User login: 15jsonuser
transport.py 563 DEBUG First name: user
transport.py 563 DEBUG Last name: new
transport.py 563 DEBUG Home directory: /home/15jsonuser
transport.py 563 DEBUG Login shell: /bin/sh
transport.py 563 DEBUG Principal name: 15jsonuser
transport.py 563 DEBUG Principal alias: 15jsonuser
transport.py 563 DEBUG Email address: 15jsonuser
transport.py 563 DEBUG UID: 1012200011
transport.py 563 DEBUG GID: 1012200011
transport.py 563 DEBUG Account disabled: False
transport.py 563 DEBUG
transport.py 563 DEBUG User login: 17jsonuser
transport.py 563 DEBUG First name: user
transport.py 563 DEBUG Last name: new
transport.py 563 DEBUG Home directory: /home/17jsonuser
transport.py 563 DEBUG Login shell: /bin/sh
transport.py 563 DEBUG Principal name: 17jsonuser
transport.py 563 DEBUG Principal alias: 17jsonuser
transport.py 563 DEBUG Email address: 17jsonuser
transport.py 563 DEBUG UID: 1012200012
transport.py 563 DEBUG GID: 1012200012
transport.py 563 DEBUG Account disabled: False
transport.py 563 DEBUG
transport.py 563 DEBUG User login: admin
transport.py 563 DEBUG Last name: Administrator
transport.py 563 DEBUG Home directory: /home/admin
transport.py 563 DEBUG Login shell: /bin/bash
transport.py 563 DEBUG Principal alias: admin
transport.py 563 DEBUG UID: 1012200000
transport.py 563 DEBUG GID: 1012200000
transport.py 563 DEBUG Account disabled: False
transport.py 563 DEBUG
transport.py 563 DEBUG User login: hr_manager
transport.py 563 DEBUG First name: new
transport.py 563 DEBUG Last name: manager
transport.py 563 DEBUG Home directory: /home/hr_manager
transport.py 563 DEBUG Login shell: /bin/sh
transport.py 563 DEBUG Principal name: hr_manager
transport.py 563 DEBUG Principal alias: hr_manager
transport.py 563 DEBUG Email address: hr_manager
transport.py 563 DEBUG UID: 1012200003
transport.py 563 DEBUG GID: 1012200003
transport.py 563 DEBUG Account disabled: False
transport.py 563 DEBUG
transport.py 563 DEBUG User login: qe_manager
transport.py 563 DEBUG First name: new
transport.py 563 DEBUG Last name: manager
transport.py 563 DEBUG Home directory: /home/qe_manager
transport.py 563 DEBUG Login shell: /bin/sh
transport.py 563 DEBUG Principal name: qe_manager
transport.py 563 DEBUG Principal alias: qe_manager
transport.py 563 DEBUG Email address: qe_manager
transport.py 563 DEBUG UID: 1012200004
transport.py 563 DEBUG GID: 1012200004
transport.py 563 DEBUG Account disabled: False
transport.py 563 DEBUG
transport.py 563 DEBUG User login: testuser2
transport.py 563 DEBUG First name: user02
transport.py 563 DEBUG Last name: user02
transport.py 563 DEBUG Home directory: /home/testuser02
transport.py 563 DEBUG Login shell: /bin/bash
transport.py 563 DEBUG Principal name: testuser2
transport.py 563 DEBUG Principal alias: testuser2, tu
transport.py 563 DEBUG Email address: user2
transport.py 563 DEBUG UID: 10010
transport.py 563 DEBUG GID: 201
transport.py 563 DEBUG Telephone Number: 919922222222
transport.py 563 DEBUG Job Title: Scenario02_modified
transport.py 563 DEBUG Account disabled: False
transport.py 563 DEBUG
transport.py 563 DEBUG User login: testuser6
transport.py 563 DEBUG First name: user06
transport.py 563 DEBUG Last name: user06
transport.py 563 DEBUG Home directory: /home/testuser6
transport.py 563 DEBUG Login shell: /bin/sh
transport.py 563 DEBUG Principal name: testuser6
transport.py 563 DEBUG Principal alias: testuser6
transport.py 563 DEBUG Email address: testuser6
transport.py 563 DEBUG UID: 1012200008
transport.py 563 DEBUG GID: 1012200008
transport.py 563 DEBUG Account disabled: False
transport.py 563 DEBUG
transport.py 563 DEBUG User login: testuser8
transport.py 563 DEBUG First name: user08
transport.py 563 DEBUG Last name: user08
transport.py 563 DEBUG Home directory: /home/testuser8
transport.py 563 DEBUG Login shell: /bin/sh
transport.py 563 DEBUG Principal name: testuser8
transport.py 563 DEBUG Principal alias: testuser8
transport.py 563 DEBUG Email address: testuser8
transport.py 563 DEBUG UID: 1012200009
transport.py 563 DEBUG GID: 1012200009
transport.py 563 DEBUG Account disabled: False
transport.py 563 DEBUG
transport.py 563 DEBUG User login: user1747413
transport.py 563 DEBUG First name: bzuser
transport.py 563 DEBUG Last name: bzuser
transport.py 563 DEBUG Home directory: /home/user1747413
transport.py 563 DEBUG Login shell: /bin/sh
transport.py 563 DEBUG Principal name: user1747413
transport.py 563 DEBUG Principal alias: user1747413
transport.py 563 DEBUG Email address: testuserbz
transport.py 563 DEBUG UID: 10002
transport.py 563 DEBUG GID: 101
transport.py 563 DEBUG Telephone Number: +445123457
transport.py 563 DEBUG Job Title: test_title
transport.py 563 DEBUG Account disabled: False
transport.py 563 DEBUG
transport.py 563 DEBUG User login: user1784474
transport.py 563 DEBUG First name: userbz02
transport.py 563 DEBUG Last name: userbz02
transport.py 563 DEBUG Home directory: /home/user1784474
transport.py 563 DEBUG Login shell: /bin/sh
transport.py 563 DEBUG Principal name: user1784474
transport.py 563 DEBUG Principal alias: user1784474
transport.py 563 DEBUG Email address: user1784474
transport.py 563 DEBUG UID: 1012200010
transport.py 563 DEBUG GID: 1012200010
transport.py 563 DEBUG Account disabled: False
transport.py 563 DEBUG -----------------------------
transport.py 563 DEBUG Number of entries returned 10
transport.py 563 DEBUG -----------------------------
channel.py 1212 DEBUG [chan 112] EOF received (112)
channel.py 1212 DEBUG [chan 112] EOF sent (112)
transport.py 217 DEBUG Exit code: 0
channel.py 1212 DEBUG [chan 113] Max packet in: 32768 bytes
channel.py 1212 DEBUG [chan 113] Max packet out: 32768 bytes
transport.py 1819 DEBUG Secsh channel 113 opened.
transport.py 318 INFO RUN ['kdestroy', '-A']
transport.py 519 DEBUG RUN ['kdestroy', '-A']
channel.py 1212 DEBUG [chan 113] Sesch channel 113 request ok
transport.py 563 DEBUG -bash: line 1: cd: /root/multihost_tests: No such file or directory
transport.py 563 DEBUG -bash: line 2: /root/multihost_tests/env.sh: No such file or directory
channel.py 1212 DEBUG [chan 113] EOF received (113)
channel.py 1212 DEBUG [chan 113] EOF sent (113)
transport.py 217 DEBUG Exit code: 0
transport.py 293 INFO WRITE inventory/user.hosts
sftp.py 158 DEBUG [chan 0] open(b'inventory/user.hosts', 'wb')
sftp.py 158 DEBUG [chan 0] open(b'inventory/user.hosts', 'wb') -> 00000000
sftp.py 158 DEBUG [chan 0] close(00000000)
transport.py 329 INFO PUT user_module.yml
sftp.py 158 DEBUG [chan 0] open(b'user_module.yml', 'wb')
sftp.py 158 DEBUG [chan 0] open(b'user_module.yml', 'wb') -> 00000000
sftp.py 158 DEBUG [chan 0] close(00000000)
sftp.py 158 DEBUG [chan 0] stat(b'user_module.yml')
channel.py 1212 DEBUG [chan 22] Max packet in: 32768 bytes
channel.py 1212 DEBUG [chan 22] Max packet out: 32768 bytes
transport.py 1819 DEBUG Secsh channel 22 opened.
transport.py 318 INFO RUN ['ansible-playbook', '--ssh-extra-args="-o StrictHostKeyChecking=no"', '-vv', '-i', 'inventory/user.hosts', 'user_module.yml']
transport.py 519 DEBUG RUN ['ansible-playbook', '--ssh-extra-args="-o StrictHostKeyChecking=no"', '-vv', '-i', 'inventory/user.hosts', 'user_module.yml']
channel.py 1212 DEBUG [chan 22] Sesch channel 22 request ok
transport.py 563 DEBUG -bash: line 1: cd: /root/multihost_tests: No such file or directory
transport.py 563 DEBUG -bash: line 2: /root/multihost_tests/env.sh: No such file or directory
transport.py 563 DEBUG ansible-playbook 2.9.11
transport.py 563 DEBUG config file = /root/ansible.cfg
transport.py 563 DEBUG configured module search path = ['/root/ansible-freeipa/plugins/modules', '/usr/share/ansible/plugins/modules']
transport.py 563 DEBUG ansible python module location = /usr/lib/python3.6/site-packages/ansible
transport.py 563 DEBUG executable location = /usr/bin/ansible-playbook
transport.py 563 DEBUG python version = 3.6.8 (default, Jun 26 2020, 12:10:09) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
transport.py 563 DEBUG Using /root/ansible.cfg as config file
transport.py 563 DEBUG
transport.py 563 DEBUG PLAYBOOK: user_module.yml ******************************************************
transport.py 563 DEBUG 1 plays in user_module.yml
transport.py 563 DEBUG
transport.py 563 DEBUG PLAY [Playbook to ensure users added correctly using json file.] ***************
transport.py 563 DEBUG
transport.py 563 DEBUG TASK [Gathering Facts] *********************************************************
transport.py 563 DEBUG task path: /root/user_module.yml:1
transport.py 563 DEBUG ok: [master.ipadomain.test]
transport.py 563 DEBUG META: ran handlers
transport.py 563 DEBUG
transport.py 563 DEBUG TASK [user add using json file] ************************************************
transport.py 563 DEBUG task path: /root/user_module.yml:6
transport.py 563 DEBUG ok: [master.ipadomain.test] => {"ansible_facts": {"users": [{"first": "user", "last": "new", "name": "16jsonuser"}, {"first": "user", "last": "new", "name": "16jsonuser"}]}, "ansible_included_var_files": ["/root/user_add.json"], "changed": false}
transport.py 563 DEBUG
transport.py 563 DEBUG TASK [Users] *******************************************************************
transport.py 563 DEBUG task path: /root/user_module.yml:10
transport.py 563 DEBUG fatal: [master.ipadomain.test]: FAILED! => {"changed": false, "msg": "user '16jsonuser' is used more than once"}
transport.py 563 DEBUG
transport.py 563 DEBUG PLAY RECAP *********************************************************************
transport.py 563 DEBUG master.ipadomain.test : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
transport.py 563 DEBUG
channel.py 1212 DEBUG [chan 22] EOF received (22)
channel.py 1212 DEBUG [chan 22] EOF sent (22)
transport.py 217 DEBUG Exit code: 2
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/RHEA-2020:4663 |
Description of problem: Can able to add user several times using different json files without any error. Version-Release number of selected component (if applicable): ansible-freeipa-0.1.8-3.el8.noarch Steps to Reproduce: consule_output ================== [root@ansible ~]# cat user_attempt1.json { "users": [ { "name": "testuser13", "first": "user", "last": "new", "uid": "1011" }, { "name": "testuser14", "first": "user", "last": "new", "uid": "1012" } ] } [root@ansible ~]# cat user_attempt1.yaml --- - name: Playbook to handle users hosts: ipaserver become: true tasks: - name: user add using json file include_vars: file: user_attempt1.json - name: Users ipauser: ipaadmin_password: Secret.123 users: "{{ users }}" [root@ansible ~]# ansible-playbook -vv -i inventory/host.hosts user_attempt1.yaml ansible-playbook 2.9.6 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: user_attempt1.yaml ***************************************************************************************************************************************************************************************************************** 1 plays in user_attempt1.yaml PLAY [Playbook to handle users] ************************************************************************************************************************************************************************************************************** TASK [Gathering Facts] *********************************************************************************************************************************************************************************************************************** task path: /root/user_attempt1.yaml:2 ok: [master.ipadomain.test] META: ran handlers TASK [user add using json file] ************************************************************************************************************************************************************************************************************** task path: /root/user_attempt1.yaml:7 ok: [master.ipadomain.test] => {"ansible_facts": {"users": [{"first": "user", "last": "new", "name": "testuser13", "uid": "1011"}, {"first": "user", "last": "new", "name": "testuser14", "uid": "1012"}]}, "ansible_included_var_files": ["/root/user_attempt1.json"], "changed": false} TASK [Users] ********************************************************************************************************************************************************************************************************************************* task path: /root/user_attempt1.yaml:11 [WARNING]: Module did not set no_log for update_password changed: [master.ipadomain.test] => {"changed": true, "user": {}} 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 ########################################### [root@ansible ~]# cat user_attempt2.json { "users": [ { "name": "testuser13", "first": "user", "last": "new", "uid": "1011" }, { "name": "testuser14", "first": "user", "last": "new", "uid": "1012" } ] } [root@ansible ~]# cat user_attempt2.yaml --- - name: Playbook to handle users hosts: ipaserver become: true tasks: - name: user add using json file include_vars: file: user_attempt2.json - name: Users ipauser: ipaadmin_password: Secret.123 users: "{{ users }}" [root@ansible ~]# ansible-playbook -vv -i inventory/host.hosts user_attempt2.yaml ansible-playbook 2.9.6 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: user_attempt2.yaml ***************************************************************************************************************************************************************************************************************** 1 plays in user_attempt2.yaml PLAY [Playbook to handle users] ************************************************************************************************************************************************************************************************************** TASK [Gathering Facts] *********************************************************************************************************************************************************************************************************************** task path: /root/user_attempt2.yaml:2 ok: [master.ipadomain.test] META: ran handlers TASK [user add using json file] ************************************************************************************************************************************************************************************************************** task path: /root/user_attempt2.yaml:7 ok: [master.ipadomain.test] => {"ansible_facts": {"users": [{"first": "user", "last": "new", "name": "testuser13", "uid": "1011"}, {"first": "user", "last": "new", "name": "testuser14", "uid": "1012"}]}, "ansible_included_var_files": ["/root/user_attempt2.json"], "changed": false} TASK [Users] ********************************************************************************************************************************************************************************************************************************* task path: /root/user_attempt2.yaml:11 [WARNING]: Module did not set no_log for update_password ok: [master.ipadomain.test] => {"changed": false, "user": {}} META: ran handlers META: ran handlers PLAY RECAP *********************************************************************************************************************************************************************************************************************************** master.ipadomain.test : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 Actual results: It just ensure users are present with different json files without any error. Expected results: It should fail with error "user with name \"<XXUSERXX>\" already exists Example: ########### [root@ansible ~]# cat user_add01.json { "users": [ { "name": "testuser15", "first": "user", "last": "new", "uid": "1011" }, { "name": "testuser15", "first": "user", "last": "new", "uid": "1011" } ] } [root@ansible ~]# cat user_add01.yaml --- - name: Playbook to handle users hosts: ipaserver become: true tasks: - name: user add using json file include_vars: file: user_add01.json - name: Users ipauser: ipaadmin_password: Secret.123 users: "{{ users }}" [root@ansible ~]# ansible-playbook -vv -i inventory/host.hosts user_add01.yaml ansible-playbook 2.9.6 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: user_add01.yaml ******************************************************************************************************************************************************************************************************************** 1 plays in user_add01.yaml PLAY [Playbook to handle users] ************************************************************************************************************************************************************************************************************** TASK [Gathering Facts] *********************************************************************************************************************************************************************************************************************** task path: /root/user_add01.yaml:2 ok: [master.ipadomain.test] META: ran handlers TASK [user add using json file] ************************************************************************************************************************************************************************************************************** task path: /root/user_add01.yaml:7 ok: [master.ipadomain.test] => {"ansible_facts": {"users": [{"first": "user", "last": "new", "name": "testuser15", "uid": "1011"}, {"first": "user", "last": "new", "name": "testuser15", "uid": "1011"}]}, "ansible_included_var_files": ["/root/user_add01.json"], "changed": false} TASK [Users] ********************************************************************************************************************************************************************************************************************************* task path: /root/user_add01.yaml:11 [WARNING]: Module did not set no_log for update_password fatal: [master.ipadomain.test]: FAILED! => {"changed": false, "msg": "user_add: testuser15: user with name \"testuser15\" already exists"} PLAY RECAP *********************************************************************************************************************************************************************************************************************************** master.ipadomain.test : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0