Bug 2164400

Summary: [RFE] Add functionality in API (to match Hammer) to Add/Delete a single Ansible role to Hostgroup without defining every role.
Product: Red Hat Satellite Reporter: mark yarborough <myarboro>
Component: Ansible - Configuration ManagementAssignee: Oleh Fedorenko <ofedoren>
Status: CLOSED ERRATA QA Contact: Gaurav Talreja <gtalreja>
Severity: medium Docs Contact: Adam Lazik <alazik>
Priority: unspecified    
Version: 6.9.7CC: alazik, apatel, aruzicka, bangelic, gtalreja, inecas, kgaikwad, lstejska, momran, nalfassi, oezr, ofedoren, pcreech, rabajaj, rkarimpa, rlavi
Target Milestone: 6.14.0Keywords: EasyFix, FutureFeature, Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-foreman_ansible-12.0.3 Doc Type: Enhancement
Doc Text:
.New API endpoints have been introduced The following API endpoints have been added: api/v2/hosts/:id/ansible_roles/:ansible_role_id:: Send a GET request to add a single Ansible role to a host or send a DELETE request to remove a single Ansible role from a host. api/v2/hostgroups/:id/ansible_roles/:ansible_role_id:: Send a GET request to add a single Ansible role to a host group or send a DELETE request to remove a single Ansible role from a host group. api/v2/organizations/:organization_id/rh_cloud/missing_hosts:: Send a GET request to list hosts that are missing in Red Hat Cloud. api/v2/webhooks/:id/test:: Send a POST request to test-fire a webhook.
Story Points: ---
Clone Of: 2029402 Environment:
Last Closed: 2023-11-08 14:18:13 UTC Type: ---
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: 2029402    
Bug Blocks:    

Comment 2 Oleh Fedorenko 2023-01-27 14:13:52 UTC
Created redmine issue https://projects.theforeman.org/issues/36015 from this bug

Comment 3 Bryan Kearney 2023-01-27 16:03:39 UTC
Upstream bug assigned to ofedoren

Comment 4 Bryan Kearney 2023-01-27 16:03:41 UTC
Upstream bug assigned to ofedoren

Comment 6 Bryan Kearney 2023-05-08 16:04:04 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36015 has been resolved.

Comment 13 Gaurav Talreja 2023-05-31 19:32:14 UTC
Verified.

Tested on Satellite 6.14.0 Snap 1.0
Version: rubygem-foreman_ansible-12.0.3-1.el8sat.noarch

Steps:
1. Create a Host/HostGroup
2. Import/Sync ansible_roles, and assign a few roles to Host/HostGroup
3. For add and remove ansible_roles for the HostGroup endpoints run "PUT /api/hostgroups/:id/ansible_roles/:ansible_role_id" and "DELETE /api/hostgroups/:id/ansible_roles/:ansible_role_id",
And for add and remove ansible_roles to Host endpoints run "PUT /api/hosts/:id/ansible_roles/:ansible_role_id" and "DELETE /api/hosts/:id/ansible_roles/:ansible_role_id"

Observation:
Add and remove API endpoints works fine for adding and removing single ansible_role with :ansible_role_id to Host/HostGroup.

Comment 18 errata-xmlrpc 2023-11-08 14:18:13 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 (Important: Satellite 6.14 security and bug fix 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/RHSA-2023:6818