Bug 1608712 - [RFE] the hammer ansible plugin can not filter imported ansible roles
Summary: [RFE] the hammer ansible plugin can not filter imported ansible roles
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Ansible
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: 6.6.0
Assignee: Oleh Fedorenko
QA Contact: Lukas Pramuk
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-26 08:07 UTC by Martin Korbel
Modified: 2019-10-22 12:46 UTC (History)
10 users (show)

Fixed In Version: tfm-rubygem-hammer_cli_foreman_ansible-0.2.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-10-22 12:46:42 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 25446 None None None 2018-11-13 15:28:56 UTC
Red Hat Product Errata RHSA-2019:3172 None None None 2019-10-22 12:46:56 UTC

Description Martin Korbel 2018-07-26 08:07:45 UTC
Description of problem:
 We can't choose which roles we want to import. The command import all available roles.

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

How reproducible:
100%

Steps to Reproduce:
1. We have got a satellite 6.4

> hammer ansible roles import
Result:   
  The following ansible roles were changed
Imported: 
 1) geerlingguy.ntp



> hammer ansible roles import --help
Usage:
    hammer ansible roles import [OPTIONS]

Options:
 --location LOCATION_NAME                Location name
 --location-id LOCATION_ID                
 --location-title LOCATION_TITLE         Location title
 --organization ORGANIZATION_NAME        Organization name
 --organization-id ORGANIZATION_ID       Organization ID
 --organization-title ORGANIZATION_TITLE Organization title
 --proxy-id PROXY_ID                     Capsule to import from
 -h, --help                              Print help


Actual results:
We can't choose which roles we want to import. 

Expected results:
We can choose which roles we want to import. Something same as in WebUI. 

Additional info:
bz1590854

Comment 1 Oleh Fedorenko 2018-08-06 09:28:59 UTC
Sorry for taking so long to reply.

I'm not sure if it is actually the hammer plugin problem, since hammer relies on Foreman's Ansible plugin API and the endpoint for the import command doesn't provide options for selecting specific roles. It just import all of them from a specific Smart proxy.

Comment 2 Martin Korbel 2018-08-06 13:19:52 UTC
Hi Oleh,
missing API in backend is not a reason for unsolving of this issue. 
I don't say it have to be fixed in this version of satellite, but it is really important for automatization.

Comment 3 Marek Hulan 2018-08-07 07:59:53 UTC
Oleh, could you please look at how much work it would be to extend foreman_ansible API so that it allows what Martin asks for? I think it would be a good addition. Once API is there, we could enhance also the hammer plugin.

Comment 4 Oleh Fedorenko 2018-08-09 16:40:07 UTC
Marek, Martin, of course. This addition (both API and plugin) is my next target after solving the second issue.

Comment 5 Ondřej Pražák 2018-11-13 15:28:52 UTC
Created redmine issue http://projects.theforeman.org/issues/25446 from this bug

Comment 6 Bryan Kearney 2019-03-28 16:07:19 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25446 has been resolved.

Comment 7 Lukas Pramuk 2019-06-10 12:09:48 UTC
VERIFIED.

@satellite-6.6.0-5.beta.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_ansible-0.3.0-2.el7sat.noarch
ansible-2.8.0-1.el7ae.noarch

by the following set of commands:

# hammer ansible roles import --help
Usage:
    hammer ansible roles import [OPTIONS]

Options:
 --location LOCATION_NAME                Location name
 --location-id LOCATION_ID                
 --location-title LOCATION_TITLE         Location title
 --organization ORGANIZATION_NAME        Organization name
 --organization-id ORGANIZATION_ID       Organization ID
 --organization-title ORGANIZATION_TITLE Organization title
 --proxy-id PROXY_ID                     Capsule to import from
 --role-names ROLE_NAMES                 Ansible role names to import
                                         Comma separated list of values. Values containing comma should be quoted or escaped with backslash.

# hammer ansible roles import --proxy-id 1 --role-names geerlingguy.ntp,linuxhq.setup
Result:   
  The following ansible roles were changed
Imported: 
 1) linuxhq.setup
 2) geerlingguy.ntp

[root@dell-per415-01 ~]# hammer ansible roles list
---|-----------------|--------------------
ID | NAME            | IMPORTED AT        
---|-----------------|--------------------
5  | linuxhq.setup   | 2019/06/10 12:03:52
6  | geerlingguy.ntp | 2019/06/10 12:03:52
---|-----------------|--------------------


>>> In CLI the user has now some sort of control of what is being imported and what not

Comment 10 errata-xmlrpc 2019-10-22 12:46:42 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, 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-2019:3172


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