Ansible role selection on host impacts hostgroup GET ansible roles api in Foreman v2.1

**Problem: While creating/updating ansible roles in host when hostgroup is attached to a host then the same changes reflecting on ansible hostgroup api ( GET /api/hostgroups/:id/ansible_roles ).

**Expected outcome: Hostgroup ansible role api ( GET /api/hostgroups/:id/ansible_roles ) shouldn’t be impacted if changes made on ansible role tab in host creation/updation when hostgroup is selected in host.

**Foreman and Proxy versions: 2.1 & 2.1.0-rc3

**Foreman and Proxy plugin versions: 2.1 & 2.1.0-rc3

**Distribution and version: CentOS v7.x86_64 & v2.1

I couldn’t reproduce this, on my devel setup (foreman 3.0).

Digging into code I didn’t find anything that could cause this.

Does this also affect hostgroup UI? Do you see those roles attached to the hostgroup in Hostgroup edit form?

I 'm using Foreman 2.1 version. No, It doesn’t impact the hostgroup UI but it impacts Hostgroup ansible role get api i.e., GET /api/hostgroups/:id/ansible_roles . I will share foreman logs as well shortly.