Skip to content

ansible.platform.role_team_assignment not working as expected #94

@wtcross

Description

@wtcross

Bug Summary

The ansible.platform.role_team_assignment docs indicate that the name and type attributes of each item in the assignment_objects module parameter can be used and the module will "internally resolve its ansible_id". This is not working and the module reports no change after not creating anything, which is basically a silent failure.

I have a temporary workaround of using the uri module to make the necessary API call. The main downside is I have to look up the id of the role_definition, team, and the object_id before making the API call.

Below is a playbook that will reproduce the issue. Run it and you will see that the last task completes with a ok status. If you check the AAP API/UI you will see it did not create anything.

I am using ansible==12.2.0 and ansible.platform-2.6.20251106 with python 3.13.8.

# reproduce-bug.yaml
---
- hosts: localhost
  connection: local
  gather_facts: no
  become: no
  tasks:
    - name: Create lab.cross.solutions organization
      ansible.platform.organization:
        state: present
        name: Test Org
        description: Just a test org
        aap_hostname: "{{ aap_hostname }}"
        aap_username: "{{ aap_admin_username }}"
        aap_password: "{{ aap_admin_password }}"
        validate_certs: false

    - name: Create a role
      ansible.platform.role_definition:
        state: present
        name: Test Role Definiton
        description: Test role definition
        content_type: shared.organization
        permissions:
          - shared.view_organization
          - awx.update_inventory
          - awx.use_inventory
          - awx.view_inventory
          - awx.execute_jobtemplate
          - awx.view_jobtemplate
          - awx.view_notificationtemplate
          - awx.update_project
          - awx.use_project
          - awx.view_project
          - awx.execute_workflowjobtemplate
          - awx.view_workflowjobtemplate
        aap_hostname: "{{ aap_hostname }}"
        aap_username: "{{ aap_admin_username }}"
        aap_password: "{{ aap_admin_password }}"
        validate_certs: false

    - name: Create a team
      ansible.platform.team:
        state: present
        name: Test Team
        description: Test team
        organization: Test Org
        aap_hostname: "{{ aap_hostname }}"
        aap_username: "{{ aap_admin_username }}"
        aap_password: "{{ aap_admin_password }}"
        validate_certs: false

    - name: Assign role to team
      ansible.platform.role_team_assignment:
        state: present
        team: Test Team
        role_definition: Test Role Definiton
        assignment_objects:
          - name: Test Org
            type: organizations
        aap_hostname: "{{ aap_hostname }}"
        aap_username: "{{ aap_admin_username }}"
        aap_password: "{{ aap_admin_password }}"
        validate_certs: false
      register: role_team_assignment_result

    - debug:
        var: role_team_assignment_result

Select the relevant components

  • Proxy
  • API
  • Other

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions