Content view filter not working

Problem:
Content view filter is not working
Expected outcome:
Should work and be able to add filter to the content view through ansible
Other relevant data:
I was trying to add filter to the content view through ansible.
Here is my code

---
- hosts: foreman
  tasks:

    - name: Add Core to the filter
      theforeman.foreman.content_view_filter:
        username: "admin"
        password: "admin"
        server_url: "myhost.com"
        name: "package filter 1"
        organization: "org"
        content_view: my Content View
        filter_type: "package_group"
        rule_name: "Core"
        filter_state: present
        rule_state: present

After running this, I am getting an error

Please let me know if I’m missing something in the ansible code. This is the filter list I got from foreman UI. I have to add Core of both Appstream and BaseOS to the filter

Any help would be appreciated

Thank you

This is the error
FAILED! => {“changed”: false, “msg”: “Found too many (4) results while searching for package_groups with name=“Core””}

Any help anyone???

@ansible , tried running the playbook again and still facing the same issue

{"changed": false, "msg": "Found too many (4) results while searching for package_groups with name=\"Core\""}

Here is the error

Not right now, no, the Ansible module is rather bad at handling filters :frowning:

Oh, okay! So only way is through hammer command line and through UI? @evgeni

Yeah, at least for complicated setups