Skip to content

roles filetree_create export missing instance_groups key #80

@w4hf

Description

@w4hf

Summary

When exporting roles using filetree_create, the instance_groups key is missing from the generated yaml file resulting in an invalid yaml file

example, if the team DB Team is assigned admin role on the instance group Test IG, the generated role looks like the following :

---
controller_roles:
  - team: "DB Team"
      - "test IG"
    role: "admin"
  - team: "QA Team"
    inventories:
      - "Demo Inventory"
    role: "admin"

You can see that the keyword instance_groups is missing between line 2 and 3
The error is also present for users

Issue Type

  • Bug Report

Ansible, Collection, Controller details

ansible --version
ansible [core 2.18.12]
  config file = /home/w4hf/projects/CAC/cac-create-24/ansible.cfg
  configured module search path = ['/home/w4hf/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.14/site-packages/ansible
  ansible collection location = /home/w4hf/projects/CAC/cac-create-24/collections
  executable location = /usr/bin/ansible
  python version = 3.14.2 (main, Dec  5 2025, 00:00:00) [GCC 15.2.1 20251111 (Red Hat 15.2.1-4)] (/usr/bin/python3)
  jinja version = 3.1.6
  libyaml = True

ansible-galaxy collection list
# /home/w4hf/projects/CAC/cac-create-24/collections/ansible_collections
Collection                     Version
------------------------------ -------
ansible.controller             4.5.25 
infra.controller_configuration 3.2.0  

Controller version
4.5.25

Desired Behavior

The exported roles file contains the instance_groups keyword

Actual Behavior

The exported roles file does not contains the instance_groups keyword


## STEPS TO REPRODUCE

1. assign a team or a user a role on an instance group
2. export roles using filetree_create
3. see that the generated yaml file is invalid because it is missing the `instance_groups` key

```yaml (playbook/task)
ansible-playbook filetree_create.yml -e flatten_output=true -vv -e '{input_tag: [roles]}'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnew

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions