-
Notifications
You must be signed in to change notification settings - Fork 178
Description
With large organizations it is helpful to split configurations and have users/teams, credentials/inventories, projects/templates, etc separately. All this works fine with the dispatch role + wildcard.
There seems to be just one corner case that causes issues, below is a minimal reproducer created from a larger real-world configuration. Being able to configure users/teams will obviously need the organization so it is defined in one place without controller-specific details. Elsewhere are settings related to the controller. This allows using them independently. However, using them all together the end result is as below.
---
- name: Configure Ansible Automation Platform
hosts: localhost
connection: local
become: false
gather_facts: false
vars:
aap_organizations_test_org:
- name: Test Org
description: Test organization
aap_organizations_test_org_ctrl:
- name: Test Org
description: Test organization
max_hosts: 10
tasks:
- name: Apply AAP configuration
vars:
dispatch_include_wildcard_vars: true
ansible.builtin.include_role:
name: infra.aap_configuration.dispatch
On a fresh AAP installation only, so not on later attempts, this leads to:
TASK [infra.aap_configuration.collect_async_status : Create/Update AAP Platform Organizations Test Org | Wait for finish the Organizations creation] ***
fatal: [localhost]: FAILED! =>
ansible_job_id: j359820304464.1550
attempts: 1
changed: false
finished: 1
msg: '{''detail'': ''duplicate key value violates unique constraint "aap_gateway_api_organization_name_key"\nDETAIL: Key
(name)=(Test Org) already exists.''}'
...
TASK [infra.aap_configuration.collect_async_status : handle_error | Show error and stop execution] ********************
fatal: [localhost]: FAILED! =>
changed: false
msg: 'error: {''detail'': ''duplicate key value violates unique constraint "aap_gateway_api_organization_name_key"\nDETAIL: Key
(name)=(Test Org) already exists.''}'
I wonder if something could be done to prevent this other than at least initially avoiding the duplicated definition? That would allow full flexibility when configuring AAP either initially or later on, whether everything at one go or in a piecemeal fashion. Thanks.