Uploaded image for project: 'Ansible Automation Platform RFEs'
  1. Ansible Automation Platform RFEs
  2. AAPRFE-641

Request lookup_organization behave the same as other lookup types for ansible.controller.role module

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      The role api code uses the lookup_organization attribute for the team AND the job_template. We are unable to configure a role if either the team OR the job_template exists in different organizations.

       

      Below, I am attempting to add a job_template (which resides in DV) to the team (which resides in Default). This does not work. It expects the team to reside in the same organization as the job_template.

      - name: Add job_template in organization DV to team in organization Default
        role:
          team: Example Team
          role: execute
          job_template: Example Job Template
          lookup_organization: DV  # I would expect this attribute to be used for lookup ONLY for the job_template.
          state: present

      The awx code below shows how the lookup_organization attribute is being used for both the team and the job_template (or resource). 

      for key in ('user', 'team'):
          if key in resources:
              if key == 'user':
                  lookup_data_populated = {}
              else:
                  lookup_data_populated = lookup_data   #<-- This is using the  lookup_organization attribute on the team. I WOULD NOT EXPECT THIS

      ref: https://github.com/ansible/tower/blob/91871642c638434c5093376baa97361129991338/awx_collection/plugins/modules/role.py#L251

       

      for key, value in resources.items():
          for resource in value:
              if key in resources:
                  if key == 'organizations':
                      lookup_data_populated = {}
                  else:
                      lookup_data_populated = lookup_data  #<-- THIS IS USING THE lookup_organization ATTRIBUTE ON THE job_template WHICH I WOULD EXPECT

      ref: https://github.com/ansible/tower/blob/91871642c638434c5093376baa97361129991338/awx_collection/plugins/modules/role.py#L268C29-L268C29

              bcoursen@redhat.com Brian Coursen
              jbird@redhat.com Jeffrey Bird
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: