mirror of
https://github.com/ansible/awx.git
synced 2026-03-10 05:59:28 -02:30
Allow lookup_organization to find teams and resources from different orgs
This commit is contained in:
@@ -268,7 +268,7 @@ def main():
|
|||||||
for resource in value:
|
for resource in value:
|
||||||
# Attempt to look up project based on the provided name, ID, or named URL and lookup data
|
# Attempt to look up project based on the provided name, ID, or named URL and lookup data
|
||||||
lookup_key = key
|
lookup_key = key
|
||||||
if key == 'organizations' or key == 'users':
|
if key == 'organizations' or key == 'users' or key == 'teams':
|
||||||
lookup_data_populated = {}
|
lookup_data_populated = {}
|
||||||
else:
|
else:
|
||||||
lookup_data_populated = lookup_data
|
lookup_data_populated = lookup_data
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
wfjt_name: "AWX-Collection-tests-role-project-wfjt-{{ test_id }}"
|
wfjt_name: "AWX-Collection-tests-role-project-wfjt-{{ test_id }}"
|
||||||
team_name: "AWX-Collection-tests-team-team-{{ test_id }}"
|
team_name: "AWX-Collection-tests-team-team-{{ test_id }}"
|
||||||
team2_name: "AWX-Collection-tests-team-team-{{ test_id }}2"
|
team2_name: "AWX-Collection-tests-team-team-{{ test_id }}2"
|
||||||
|
org2_name: "AWX-Collection-tests-organization-{{ test_id }}2"
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Create a User
|
- name: Create a User
|
||||||
@@ -209,6 +210,40 @@
|
|||||||
that:
|
that:
|
||||||
- "result is changed"
|
- "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:
|
always:
|
||||||
- name: Delete a User
|
- name: Delete a User
|
||||||
user:
|
user:
|
||||||
@@ -252,3 +287,16 @@
|
|||||||
organization: Default
|
organization: Default
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user