Remove ansible roles fron Hostgroup


When adding Ansible roles to Hostgroup everything works well bit when try to remove it from the Hostgroup the UI returns OK but the role stays in the HG.

Expected outcome:
Ansible role removed from the hostgroup

Foreman and Proxy versions:
Foreman: 1.16.1
Katello 3.5

Production.log extract:

2018-04-10 12:29:30 014e1fe3 [app] [I] Started PATCH "/hostgroups/2-CentOS%20RD%20hosts" for at 2018-04-10 12:29:30 +0200
2018-04-10 12:29:30 014e1fe3 [app] [I] Processing by HostgroupsController#update as */*
2018-04-10 12:29:30 014e1fe3 [app] [I]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"aM7KhDorRK9C+MjTDJuwuaFtC03fhZXkQ0iEGHIxHdXzmfC3Ua3o4H4tJwf0ygMd/JUzDKqqtX3439pGBiEg7Q==", "hostgroup"=>{"parent_id"=>"", "name"=>"CentOS R&D hosts", "description"=>"", "lifecycle_environment_id"=>"10", "content_view_id"=>"4", "content_source_id"=>"1", "environment_id"=>"1", "compute_profile_id"=>"2", "puppet_proxy_id"=>"1", "puppet_ca_proxy_id"=>"1", "ansible_role_ids"=>[""], "puppetclass_ids"=>[""], "domain_id"=>"6", "subnet_id"=>"4", "realm_id"=>"1", "architecture_id"=>"1", "operatingsystem_id"=>"2", "kickstart_repository_id"=>"32", "ptable_id"=>"131", "pxe_loader"=>"PXELinux BIOS", "group_parameters_attributes"=>{"0"=>{"name"=>"enable-epel", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"8"}, "1"=>{"name"=>"kt_activation_keys", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"1"}, "2"=>{"name"=>"package_upgrade", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"9"}, "3"=>{"name"=>"selinux-mode", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"4"}}, "location_ids"=>["2", ""], "organization_ids"=>["3", ""], "id"=>"2"}, "media_selector"=>"synced_content", "kt_activation_keys"=>"ActKey-CentOS7", "id"=>"2-CentOS RD hosts"}
2018-04-10 12:29:30 014e1fe3 [app] [I] Current user: xxxxxxx (administrator)
2018-04-10 12:29:31 014e1fe3 [app] [I] Redirected to
2018-04-10 12:29:31 014e1fe3 [app] [I] Completed 302 Found in 108ms (ActiveRecord: 11.1ms)
2018-04-10 12:29:31 69ce262b [app] [I] Started GET "/hostgroups" for at 2018-04-10 12:29:31 +0200
2018-04-10 12:29:31 69ce262b [app] [I] Processing by HostgroupsController#index as */*
2018-04-10 12:29:31 69ce262b [app] [I] Current user: xxxxxxxx (administrator)
2018-04-10 12:29:31 69ce262b [app] [I]   Rendered common/_pagination.html.erb (0.9ms)
2018-04-10 12:29:31 69ce262b [app] [I]   Rendered hostgroups/index.html.erb within layouts/application (110.0ms)
2018-04-10 12:29:31 69ce262b [app] [I]   Rendered common/_searchbar.html.erb (7.4ms)
2018-04-10 12:29:31 69ce262b [app] [I]   Rendered layouts/_application_content.html.erb (8.2ms)
2018-04-10 12:29:31 69ce262b [app] [I]   Rendered home/_user_dropdown.html.erb (2.5ms)
2018-04-10 12:29:31 69ce262b [app] [I] Read fragment views/tabs_and_title_records-4 (0.2ms)
2018-04-10 12:29:31 69ce262b [app] [I]   Rendered home/_topbar.html.erb (7.6ms)
2018-04-10 12:29:31 69ce262b [app] [I]   Rendered layouts/base.html.erb (9.8ms)
2018-04-10 12:29:31 69ce262b [app] [I] Completed 200 OK in 148ms (Views: 120.3ms | ActiveRecord: 12.0ms)
2018-04-10 12:29:37 70825436 [app] [I] Started GET "/notification_recipients" for at 2018-04-10 12:29:37 +0200
2018-04-10 12:29:37 70825436 [app] [I] Processing by NotificationRecipientsController#index as JSON
2018-04-10 12:29:37 70825436 [app] [I] Current user: xxxxxxxx (administrator)
2018-04-10 12:29:37 70825436 [app] [I] Completed 200 OK in 6ms (Views: 0.2ms | ActiveRecord: 0.5ms)

Any Idea why this happen?

Thanks and rgds,

please also specify the version of foreman_ansible you’re using

Here whats installed:

ansible.noarch 2.5.0-2.el7 @epel
rubygem-smart_proxy_ansible.noarch 2.0.2-1.fm1_16.el7 @foreman-plugins
tfm-rubygem-foreman_ansible.noarch 1.5.2-1.fm1_16.el7 @foreman-plugins
tfm-rubygem-foreman_ansible_core.noarch 2.0.2-1.fm1_16.el7 @foreman-plugins


Finally we did remove it in the DB and now we are able to add it or remove it using the UI.