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 2121161 - Creating a POSIX trust agreement using 'range_type: ipa-ad-trust-posix' in ansible playbook is not honoring 'range_type'
Summary: Creating a POSIX trust agreement using 'range_type: ipa-ad-trust-posix' in an...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: ansible-freeipa
Version: 8.6
Hardware: Unspecified
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Thomas Woerner
QA Contact: Varun Mylaraiah
URL:
Whiteboard:
Depends On:
Blocks: 2132781 2132967
TreeView+ depends on / blocked
 
Reported: 2022-08-24 16:49 UTC by Alok Sharma
Modified: 2023-02-21 05:33 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2132781 2132967 (view as bug list)
Environment:
Last Closed: 2022-10-24 07:51:47 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FREEIPA-8683 0 None None None 2022-08-24 17:06:05 UTC
Red Hat Issue Tracker RHELPLAN-132230 0 None None None 2022-08-24 17:06:10 UTC

Description Alok Sharma 2022-08-24 16:49:05 UTC
Description of problem:
Creating a POSIX trust agreement using 'range_type: ipa-ad-trust-posix' in ansible playbook is not honoring  'range_type'.

Version-Release number of selected component (if applicable):

ansible-freeipa-1.6.3-1.el8.noarch
ansible-core-2.12.2-4.el8_6.x86_64

How reproducible:

Setting up a trust agreement using Ansible in IPA

Steps to Reproduce:

1] Playbook:
===========
[alok@iparh8 ansible]$ cat ad-trust.yml 
---
- name: Playbook to create a trust
  hosts: ipaserver
  become: true

  tasks:
    - name: ensure the trust is present
      ipatrust:
        ipaadmin_password: admin@123
        realm: gsslab1.idm.global
        server: ad1.gsslab1.idm.global
        admin: Administrator
        password: RedHat1!
        range_type: ipa-ad-trust-posix
        state: present
==============

2. Run the playbook:
~~~~~
# ansible-playbook -v -i inventory add-trust.yml
~~~~~


Actual results:
From my testbox:
=======================
- With ansible: It is not honoring the posix (range_type)
-----------
[alok@iparh8 ansible]$ sudo ansible-playbook ad-trust.yml -i inventory -K -k
SSH password: 
BECOME password[defaults to SSH password]: 

PLAY [Playbook to create a trust] ****************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************
ok: [10.x.y.z]

TASK [ensure the trust is present] ***************************************************************************************************************
changed: [10.x.y.z]

PLAY RECAP ***************************************************************************************************************************************
10.x.y.z               : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0


[alok@iparh8 ansible]$ ipa idrange-find
----------------
4 ranges matched
----------------
  Range name: CHILD1.GSSLAB1.IDM.GLOBAL_id_range
  First Posix ID of the range: 1683400000
  Number of IDs in the range: 200000
  First RID of the corresponding RID range: 0
  Domain SID of the trusted domain: S-1-5-21-3045475326-3888855959-3788818281
  Range type: Active Directory domain range <========

  Range name: GSSLAB1.IDM.GLOBAL_id_range
  First Posix ID of the range: 974000000
  Number of IDs in the range: 200000
  First RID of the corresponding RID range: 0
  Domain SID of the trusted domain: S-1-5-21-1085376446-3207835317-365312986
  Range type: Active Directory domain range <======

  Range name: TEST8.ALOK_id_range
  First Posix ID of the range: 1272000000
  Number of IDs in the range: 200000
  First RID of the corresponding RID range: 1000
  First RID of the secondary RID range: 100000000
  Range type: local domain range

  Range name: TEST8.ALOK_subid_range
  First Posix ID of the range: 2147483648
  Number of IDs in the range: 2147352576
  First RID of the corresponding RID range: 2147283648
  Domain SID of the trusted domain: S-1-5-21-738065-838566-3669934003
  Range type: Active Directory domain range
----------------------------
Number of entries returned 4
----------------------------
[alok@iparh8 ansible]$ 
-----------

- Manual:  honoring the posix (range_type)
-----------
[alok@iparh8 ansible]$ ipa trust-add  --type=ad gsslab1.idm.global --admin Administrator --password --range-type=ipa-ad-trust-posix
Active Directory domain administrator's password: 
-----------------------------------------------------------
Added Active Directory trust for realm "gsslab1.idm.global"
-----------------------------------------------------------
  Realm name: gsslab1.idm.global
  Domain NetBIOS name: IDM1
  Domain Security Identifier: S-1-5-21-1085376446-3207835317-365312986
  Trust direction: Trusting forest
  Trust type: Active Directory domain
  Trust status: Established and verified

[alok@iparh8 ansible]$ ipa idrange-find
----------------
3 ranges matched
----------------
  Range name: GSSLAB1.IDM.GLOBAL_id_range
  First Posix ID of the range: 974000000
  Number of IDs in the range: 200000
  Domain SID of the trusted domain: S-1-5-21-1085376446-3207835317-365312986
  Range type: Active Directory trust range with POSIX attributes <=======

  Range name: TEST8.ALOK_id_range
  First Posix ID of the range: 1272000000
  Number of IDs in the range: 200000
  First RID of the corresponding RID range: 1000
  First RID of the secondary RID range: 100000000
  Range type: local domain range

  Range name: TEST8.ALOK_subid_range
  First Posix ID of the range: 2147483648
  Number of IDs in the range: 2147352576
  First RID of the corresponding RID range: 2147283648
  Domain SID of the trusted domain: S-1-5-21-738065-838566-3669934003
  Range type: Active Directory domain range
----------------------------
Number of entries returned 3
----------------------------
-----------
=======================


Expected results:

Create successfully a POSIX trust agreement using ansible i.e 'range_type: ipa-ad-trust-posix'.

Range type: Active Directory trust range with POSIX attributes


Additional info:

Comment 3 Thomas Woerner 2022-10-06 16:37:01 UTC
Upstream PRs:
https://github.com/freeipa/ansible-freeipa/pull/808 - ipatrust: Set valid choices for trust_type.
https://github.com/freeipa/ansible-freeipa/pull/810 - ipatrust: fix range_type and test enhancement.


Note You need to log in before you can comment on or make changes to this bug.