mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 15:02:07 -03:30
Allow lookup_organization to find teams and resources from different orgs
This commit is contained in:
parent
6f7d5ca8a3
commit
8fb5862223
@ -268,7 +268,7 @@ def main():
|
||||
for resource in value:
|
||||
# Attempt to look up project based on the provided name, ID, or named URL and lookup data
|
||||
lookup_key = key
|
||||
if key == 'organizations' or key == 'users':
|
||||
if key == 'organizations' or key == 'users' or key == 'teams':
|
||||
lookup_data_populated = {}
|
||||
else:
|
||||
lookup_data_populated = lookup_data
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
wfjt_name: "AWX-Collection-tests-role-project-wfjt-{{ test_id }}"
|
||||
team_name: "AWX-Collection-tests-team-team-{{ test_id }}"
|
||||
team2_name: "AWX-Collection-tests-team-team-{{ test_id }}2"
|
||||
org2_name: "AWX-Collection-tests-organization-{{ test_id }}2"
|
||||
|
||||
- block:
|
||||
- name: Create a User
|
||||
@ -209,6 +210,40 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a 2nd organization
|
||||
organization:
|
||||
name: "{{ org2_name }}"
|
||||
|
||||
- name: Create a project in 2nd Organization
|
||||
project:
|
||||
name: "{{ project_name }}"
|
||||
organization: "{{ org2_name }}"
|
||||
scm_type: git
|
||||
scm_url: https://github.com/ansible/test-playbooks
|
||||
wait: true
|
||||
register: project_info
|
||||
|
||||
- name: Add Joe and teams to the update role of the default Project with lookup from the 2nd Organization
|
||||
role:
|
||||
user: "{{ username }}"
|
||||
users:
|
||||
- "{{ username }}2"
|
||||
teams:
|
||||
- "{{ team_name }}"
|
||||
- "{{ team2_name }}"
|
||||
role: update
|
||||
lookup_organization: "{{ org2_name }}"
|
||||
project: "{{ project_name }}"
|
||||
state: "{{ item }}"
|
||||
register: result
|
||||
with_items:
|
||||
- "present"
|
||||
- "absent"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
always:
|
||||
- name: Delete a User
|
||||
user:
|
||||
@ -252,3 +287,16 @@
|
||||
organization: Default
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Delete the 2nd project
|
||||
project:
|
||||
name: "{{ project_name }}"
|
||||
organization: "{{ org2_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Delete the 2nd organization
|
||||
organization:
|
||||
name: "{{ org2_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user