diff --git a/.github/disabled_workflows/ci_standalone_versioned.yml b/.github/disabled_workflows/ci_standalone_versioned.yml index c4ff5c91..c4cba867 100644 --- a/.github/disabled_workflows/ci_standalone_versioned.yml +++ b/.github/disabled_workflows/ci_standalone_versioned.yml @@ -86,8 +86,8 @@ jobs: run: ansible-galaxy collection install -r .github/collections/requirements.yml - name: "Perform playbook tests" - run: ansible-playbook tests/configure_controller.yml -e controller_hostname=localhost:8043 -v -e awx_version=${{ inputs.awx_version }} + run: ansible-playbook tests/configure_controller.yml -e aap_hostname=localhost:8043 -v -e awx_version=${{ inputs.awx_version }} - name: "Perform export model playbook tests" - run: ansible-playbook tests/configure_controller_export_model.yml -e controller_hostname=localhost:8043 -v -e awx_version=${{ inputs.awx_version }} + run: ansible-playbook tests/configure_controller_export_model.yml -e aap_hostname=localhost:8043 -v -e awx_version=${{ inputs.awx_version }} ... diff --git a/README.md b/README.md index f8f3d5f5..c20d11f6 100644 --- a/README.md +++ b/README.md @@ -93,12 +93,12 @@ Otherwise it will look for the modules only in your base installation. If there ``` Define following vars here, or in `controller_configs/controller_auth.yml` -`controller_hostname: ansible-controller-web-svc-test-project.example.com` +`aap_hostname: ansible-controller-web-svc-test-project.example.com` You can also specify authentication by a combination of either: -- `controller_hostname`, `controller_username`, `controller_password` -- `controller_hostname`, `controller_oauthtoken` +- `aap_hostname`, `aap_username`, `aap_password` +- `aap_hostname`, `aap_oauthtoken` The OAuth2 token is the preferred method. You can obtain the token through the preferred `controller_token` module, or through the AWX CLI [login](https://docs.ansible.com/automation-controller/latest/html/controllerapi/authentication.html) @@ -129,9 +129,9 @@ Controller token module would be invoked with this code: description: 'Creating token to test controller jobs' scope: "write" state: present - controller_host: "{{ controller_hostname }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" + controller_host: "{{ aap_hostname }}" + aap_username: "{{ aap_username }}" + aap_password: "{{ aap_password }}" ``` diff --git a/docs/CONVERSION_GUIDE.md b/docs/CONVERSION_GUIDE.md index b2489ccb..b47260be 100644 --- a/docs/CONVERSION_GUIDE.md +++ b/docs/CONVERSION_GUIDE.md @@ -30,7 +30,7 @@ The Following Variables need to be changed: |:---:|:---:| |`tower_ad_hoc_commands`|`controller_ad_hoc_commands`| |`tower_ad_hoc_commands_cancel`|`controller_ad_hoc_commands_cancel`| -|`tower_applications`|`controller_applications`| +|`tower_applications`|`aap_applications`| |`tower_credential_input_sources`|`controller_credential_input_sources`| |`tower_credential_types`|`controller_credential_types`| |`tower_credentials`|`controller_credentials`| @@ -46,13 +46,13 @@ The Following Variables need to be changed: |`tower_labels`|`controller_labels`| |`tower_license`|`controller_license`| |`tower_notifications`|`controller_notifications`| -|`tower_organizations`|`controller_organizations`| +|`tower_organizations`|`aap_organizations`| |`tower_projects`|`controller_projects`| |`tower_rbac`|`controller_roles`| |`tower_schedules`|`controller_schedules`| |`tower_settings`|`controller_settings`| -|`tower_teams`|`controller_teams`| -|`tower_user_accounts`|`controller_user_accounts`| +|`tower_teams`|`aap_teams`| +|`tower_user_accounts`|`aap_user_accounts`| |`tower_workflows`|`controller_workflows`| |`tower_workflow_launch_jobs`|`controller_workflow_launch_jobs`| @@ -60,10 +60,10 @@ The Following Variables need to be changed: |Tower Variable Name|Controller Variable Name| |:---:|:---:| -|`tower_username`|`controller_username`| -|`tower_password`|`controller_password`| -|`tower_oauthtoken`|`controller_oauthtoken`| -|`tower_hostname`|`controller_hostname`| +|`tower_username`|`aap_username`| +|`tower_password`|`aap_password`| +|`tower_oauthtoken`|`aap_oauthtoken`| +|`tower_hostname`|`aap_hostname`| |`tower_config_file`|`controller_config_file`| |`tower_validate_certs`|`controller_validate_certs`| diff --git a/playbooks/flatten_filetree_create_output.yaml b/playbooks/flatten_filetree_create_output.yaml index c37bf882..cacee59e 100644 --- a/playbooks/flatten_filetree_create_output.yaml +++ b/playbooks/flatten_filetree_create_output.yaml @@ -5,17 +5,17 @@ gather_facts: false vars: filetree_controller_settings: &filetree_create_output_dir "{{ filetree_create_output_dir }}" - filetree_controller_organizations: *filetree_create_output_dir + filetree_aap_organizations: *filetree_create_output_dir filetree_controller_labels: *filetree_create_output_dir - filetree_controller_user_accounts: *filetree_create_output_dir - filetree_controller_teams: *filetree_create_output_dir + filetree_aap_user_accounts: *filetree_create_output_dir + filetree_aap_teams: *filetree_create_output_dir filetree_controller_credential_types: *filetree_create_output_dir filetree_controller_credentials: *filetree_create_output_dir filetree_controller_credential_input_sources: *filetree_create_output_dir filetree_controller_notifications: *filetree_create_output_dir filetree_controller_projects: *filetree_create_output_dir filetree_controller_execution_environments: *filetree_create_output_dir - filetree_controller_applications: *filetree_create_output_dir + filetree_aap_applications: *filetree_create_output_dir filetree_controller_inventories: *filetree_create_output_dir filetree_controller_inventory_sources: *filetree_create_output_dir filetree_controller_instance_groups: *filetree_create_output_dir @@ -47,14 +47,14 @@ loop: - name: controller_settings value: "{{ controller_settings }}" - - name: controller_organizations - value: "{{ controller_organizations }}" + - name: aap_organizations + value: "{{ aap_organizations }}" - name: controller_labels value: "{{ controller_labels }}" - - name: controller_user_accounts - value: "{{ controller_user_accounts }}" - - name: controller_teams - value: "{{ controller_teams }}" + - name: aap_user_accounts + value: "{{ aap_user_accounts }}" + - name: aap_teams + value: "{{ aap_teams }}" - name: controller_credential_types value: "{{ controller_credential_types }}" - name: controller_credentials @@ -67,8 +67,8 @@ value: "{{ controller_projects }}" - name: controller_execution_environments value: "{{ controller_execution_environments }}" - - name: controller_applications - value: "{{ controller_applications }}" + - name: aap_applications + value: "{{ aap_applications }}" - name: controller_inventories value: "{{ controller_inventories }}" - name: controller_inventory_sources diff --git a/playbooks/get_stats.yml b/playbooks/get_stats.yml index f3d14e7f..fec1476f 100644 --- a/playbooks/get_stats.yml +++ b/playbooks/get_stats.yml @@ -7,19 +7,19 @@ gather_facts: true vars: # Using the Tower env names for backwards compatibility - controller_hostname: "{{ lookup('ansible.builtin.env', 'TOWER_HOST') }}" - controller_username: "{{ lookup('ansible.builtin.env', 'TOWER_USERNAME') }}" - controller_password: "{{ lookup('ansible.builtin.env', 'TOWER_PASSWORD') }}" + aap_hostname: "{{ lookup('ansible.builtin.env', 'TOWER_HOST') }}" + aap_username: "{{ lookup('ansible.builtin.env', 'TOWER_USERNAME') }}" + aap_password: "{{ lookup('ansible.builtin.env', 'TOWER_PASSWORD') }}" controller_validate_certs: "{{ lookup('ansible.builtin.env', 'TOWER_VERIFY_SSL') | default(false) }}" tasks: - name: Get number of JT ansible.builtin.uri: - url: "https://{{ controller_hostname }}/api/v2/metrics/?format=json" + url: "https://{{ aap_hostname }}/api/controller/v2/metrics/?format=json" method: GET force_basic_auth: true - user: "{{ controller_username }}" - password: "{{ controller_password }}" + user: "{{ aap_username }}" + password: "{{ aap_password }}" return_content: true headers: Content-Type: application/json @@ -39,11 +39,11 @@ - name: Get users info ansible.builtin.uri: - url: "https://{{ controller_hostname }}/api/v2/users/?format=json" + url: "https://{{ aap_hostname }}/api/controller/v2/users/?format=json" method: GET force_basic_auth: true - user: "{{ controller_username }}" - password: "{{ controller_password }}" + user: "{{ aap_username }}" + password: "{{ aap_password }}" return_content: true headers: Content-Type: application/json @@ -82,11 +82,11 @@ - name: Get subscription info ansible.builtin.uri: - url: "https://{{ controller_hostname }}/api/v2/settings/all/?format=json" + url: "https://{{ aap_hostname }}/api/controller/v2/settings/all/?format=json" method: GET force_basic_auth: true - user: "{{ controller_username }}" - password: "{{ controller_password }}" + user: "{{ aap_username }}" + password: "{{ aap_password }}" return_content: true headers: Content-Type: application/json diff --git a/plugins/lookup/controller_object_diff.py b/plugins/lookup/controller_object_diff.py index 913fc8f8..0afe2d4b 100644 --- a/plugins/lookup/controller_object_diff.py +++ b/plugins/lookup/controller_object_diff.py @@ -51,19 +51,19 @@ - name: Get the organization ID set_fact: controller_organization_id: "{{ lookup('awx.awx.controller_api', 'organizations', query_params={ 'name': 'Default' }, - host=controller_hostname, username=controller_username, password=controller_password, verify_ssl=false) }}" + host=aap_hostname, username=aap_username, password=aap_password, verify_ssl=false) }}" - name: "Get the API list of all Projects in the Default Organization" set_fact: controller_api_results: "{{ lookup('awx.awx.controller_api', 'projects', query_params={ 'organization': - controller_organization_id.id } ,host=controller_hostname, username=controller_username, - password=controller_password, verify_ssl=false) }}" + controller_organization_id.id } ,host=aap_hostname, username=aap_username, + password=aap_password, verify_ssl=false) }}" - name: "Get the API in a list form. Useful for making sure the results of one item is set to a list." set_fact: controller_api_results: "{{ query('awx.awx.controller_api', 'inventories', query_params={ 'organization': - controller_organization_id.id } ,host=controller_hostname, username=controller_username, - password=controller_password, verify_ssl=false) }}" + controller_organization_id.id } ,host=aap_hostname, username=aap_username, + password=aap_password, verify_ssl=false) }}" - name: "Find the difference of Project between what is on the Controller versus curated list." set_fact: diff --git a/plugins/modules/controller_export_diff.py b/plugins/modules/controller_export_diff.py index 6ca45fdf..be7a8835 100644 --- a/plugins/modules/controller_export_diff.py +++ b/plugins/modules/controller_export_diff.py @@ -118,14 +118,12 @@ aliases: [ tower_host ] controller_username: description: - - Username for your controller instance. - - If value not set, will try environment variable C(CONTROLLER_USERNAME) and then config files + - Username to connect to your Automation Platform Controller instance. type: str aliases: [ tower_username ] controller_password: description: - - Password for your controller instance. - - If value not set, will try environment variable C(CONTROLLER_PASSWORD) and then config files + - Password to connect to your Automation Platform Controller instance. type: str aliases: [ tower_password ] controller_oauthtoken: @@ -194,8 +192,8 @@ credential: gitlab-personal-access-token for satqe_auto_droid wait: false controller_host: https://controller - controller_username: admin - controller_password: secret123 + aap_username: admin + aap_password: secret123 validate_certs: false register: export_results ... diff --git a/roles/aap_rules_validation/defaults/main.yml b/roles/aap_rules_validation/defaults/main.yml index d97e6b62..522b6c0c 100644 --- a/roles/aap_rules_validation/defaults/main.yml +++ b/roles/aap_rules_validation/defaults/main.yml @@ -35,7 +35,7 @@ __object_var_names: projects: controller_projects job_templates: controller_templates inventories: controller_inventories - applications: controller_applications + applications: aap_applications hosts: controller_hosts credential_input_sources: controller_credential_input_sources credentials: controller_credentials @@ -47,11 +47,11 @@ __object_var_names: inventory_sources: controller_inventory_sources labels: controller_labels notification_templates: controller_notifications - organizations: controller_organizations + organizations: aap_organizations roles: controller_roles settings: controller_settings - teams: controller_teams - users: controller_user_accounts + teams: aap_teams + users: aap_user_accounts workflow_job_templates: controller_workflows schedules: controller_schedules diff --git a/roles/aap_rules_validation/tasks/check_users.yml b/roles/aap_rules_validation/tasks/check_users.yml index 598fef7d..8a8afaba 100644 --- a/roles/aap_rules_validation/tasks/check_users.yml +++ b/roles/aap_rules_validation/tasks/check_users.yml @@ -19,7 +19,7 @@ msg: "Rule {{ rule_id }} | users | {{ __user_org }} | {{ __username }} | The user's password is not encrypted" __username: "{{ __unencrypted_user['username'] | default(__unencrypted_user['user']) }}" __user_org: "{{ __unencrypted_user['organization'] | default('__undefined_org__') }}" - loop: "{{ controller_user_accounts | selectattr('password', 'defined') | rejectattr('password', 'vault_encrypted') }}" + loop: "{{ aap_user_accounts | selectattr('password', 'defined') | rejectattr('password', 'vault_encrypted') }}" when: rule['encrypt_user_passwords'] is defined and rule['encrypt_user_passwords'] | bool and __unencrypted_user['username'] | default(__unencrypted_user['user']) not in (rule['exceptions']['users'] | default([])) @@ -46,7 +46,7 @@ msg: "Rule {{ rule_id }} | users | {{ __user_org }} | {{ __username }} | Superusers are not allowed" __username: "{{ __superusers['username'] | default(__superusers['user']) }}" __user_org: "{{ __superusers['organization'] | default('__undefined_org__') }}" - loop: "{{ controller_user_accounts | selectattr('is_superuser', 'defined') | rejectattr('is_superuser', 'false') }}" + loop: "{{ aap_user_accounts | selectattr('is_superuser', 'defined') | rejectattr('is_superuser', 'false') }}" when: rule['allow_superusers'] is defined and not rule['allow_superusers'] | bool and __superusers['username'] | default(__superusers['user']) not in (rule['exceptions']['users'] | default([])) @@ -76,7 +76,7 @@ when: rule['allow_system_auditors'] is defined and not rule['allow_system_auditors'] | bool and __system_auditors['username'] | default(__system_auditors['user']) not in (rule['exceptions']['users'] | default([])) - loop: "{{ controller_user_accounts | selectattr('is_system_auditor', 'defined') | rejectattr('is_system_auditor', 'false') }}" + loop: "{{ aap_user_accounts | selectattr('is_system_auditor', 'defined') | rejectattr('is_system_auditor', 'false') }}" loop_control: loop_var: __system_auditors ... diff --git a/roles/aap_rules_validation/tasks/rule_check.yml b/roles/aap_rules_validation/tasks/rule_check.yml index a1902527..d09433bc 100644 --- a/roles/aap_rules_validation/tasks/rule_check.yml +++ b/roles/aap_rules_validation/tasks/rule_check.yml @@ -38,11 +38,11 @@ - name: Organizations specific checks - {{ object_type }} ansible.builtin.include_tasks: file: tasks/check_organizations.yml - when: controller_organizations is defined - and controller_organizations | length > 0 + when: aap_organizations is defined + and aap_organizations | length > 0 and 'organizations' in rule['objects'] and (org['name'] in rule['organizations'] if rule['organizations'] is defined else true) - loop: "{{ controller_organizations }}" + loop: "{{ aap_organizations }}" loop_control: loop_var: org @@ -78,8 +78,8 @@ - name: User specific checks ansible.builtin.include_tasks: file: tasks/check_users.yml - when: controller_user_accounts is defined - and controller_user_accounts | length > 0 + when: aap_user_accounts is defined + and aap_user_accounts | length > 0 and 'users' in rule['objects'] and ( diff --git a/roles/filetree_create/README.md b/roles/filetree_create/README.md index 67228a1a..957a51e7 100644 --- a/roles/filetree_create/README.md +++ b/roles/filetree_create/README.md @@ -46,9 +46,9 @@ A list of other roles hosted on Galaxy should go here, plus any details in regar connection: local gather_facts: false vars: - controller_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" - controller_password: "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" - controller_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" + aap_username: "{{ vault_aap_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" + aap_password: "{{ vault_aap_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" + aap_hostname: "{{ vault_aap_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" controller_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}" pre_tasks: @@ -56,9 +56,9 @@ A list of other roles hosted on Galaxy should go here, plus any details in regar block: - name: "Get the Authentication Token for the future requests" ansible.builtin.uri: - url: "https://{{ controller_hostname }}/api/v2/tokens/" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}/api/gateway/v1/tokens/" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: POST force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" @@ -67,10 +67,10 @@ A list of other roles hosted on Galaxy should go here, plus any details in regar - name: "Set the oauth token to be used since now" ansible.builtin.set_fact: - controller_oauthtoken: "{{ authtoken_res.json.token }}" - controller_oauthtoken_url: "{{ authtoken_res.json.url }}" + aap_oauthtoken: "{{ authtoken_res.json.token }}" + aap_oauthtoken_url: "{{ authtoken_res.json.url }}" no_log: "{{ controller_configuration_filetree_create_secure_logging | default('false') }}" - when: controller_oauthtoken is not defined + when: aap_oauthtoken is not defined tags: - always @@ -80,14 +80,14 @@ A list of other roles hosted on Galaxy should go here, plus any details in regar post_tasks: - name: "Delete the Authentication Token used" ansible.builtin.uri: - url: "https://{{ controller_hostname }}{{ controller_oauthtoken_url }}" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}{{ aap_oauthtoken_url }}" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: DELETE force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" status_code: 204 - when: controller_oauthtoken_url is defined + when: aap_oauthtoken_url is defined ... ``` @@ -100,7 +100,7 @@ This role can generate output files in two different ways: The export can be triggered with the following command: ```console - ansible-playbook -i localhost, filetree_create.yml -e '{controller_validate_certs: false, controller_hostname: localhost:8443, controller_username: admin, controller_password: password}' + ansible-playbook -i localhost, filetree_create.yml -e '{controller_validate_certs: false, aap_hostname: localhost:8443, aap_username: admin, aap_password: password}' ``` One example of this approach follows: @@ -171,7 +171,7 @@ This role can generate output files in two different ways: The expotation can be triggered with the following command: ```console - ansible-playbook -i localhost, filetree_create.yml -e '{controller_validate_certs: false, controller_hostname: localhost:8443, controller_username: admin, controller_password: password, flatten_output: true}' + ansible-playbook -i localhost, filetree_create.yml -e '{controller_validate_certs: false, aap_hostname: localhost:8443, aap_username: admin, aap_password: password, flatten_output: true}' ``` One example of this approach follows: @@ -221,9 +221,9 @@ This example will export all object but some with modifications: connection: local gather_facts: false vars: - controller_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" - controller_oauthtoken : "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_OAUTHTOKEN')) }}" - controller_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" + aap_username: "{{ vault_aap_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" + aap_oauthtoken : "{{ vault_aap_password | default(lookup('env', 'CONTROLLER_OAUTHTOKEN')) }}" + aap_hostname: "{{ vault_aap_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" controller_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}" templates_overrides_resources: diff --git a/roles/filetree_create/automatetheautomation.md b/roles/filetree_create/automatetheautomation.md index 67a416bb..26cea7f2 100644 --- a/roles/filetree_create/automatetheautomation.md +++ b/roles/filetree_create/automatetheautomation.md @@ -21,7 +21,7 @@ Utilizing the Automation Webhook capabilities in Ansible Tower / Controller, you ## Automation Controller Workflow CasC -![Automation Controller Workflow CasC](https://github.com/redhat-cop/aap_configuration_extended/blob/devel/tests/automatetheautomation/pictures/AAP_CasC_Worflow.png) +![Automation Controller Workflow CasC](../../tests/automatetheautomation/pictures/AAP_CasC_Worflow.png) *Automation Controller Workflow CasC* The workflow will have the following steps: diff --git a/roles/filetree_create/defaults/main.yml b/roles/filetree_create/defaults/main.yml index 2f4524f0..6993df54 100644 --- a/roles/filetree_create/defaults/main.yml +++ b/roles/filetree_create/defaults/main.yml @@ -8,13 +8,13 @@ controller_hosts: [] controller_inventories: [] controller_inventory_sources: [] controller_job_templates: [] -controller_organizations: [] +aap_organizations: [] controller_projects: [] controller_roles: [] controller_schedules: [] controller_settings: [] -controller_teams: [] -controller_user_accounts: [] +aap_teams: [] +aap_user_accounts: [] controller_workflows: [] # Output directory path diff --git a/roles/filetree_create/meta/argument_specs.yml b/roles/filetree_create/meta/argument_specs.yml index 37b35f88..07d59938 100644 --- a/roles/filetree_create/meta/argument_specs.yml +++ b/roles/filetree_create/meta/argument_specs.yml @@ -54,27 +54,27 @@ argument_specs: required: false description: The state all objects will take unless overridden by object default type: str - controller_hostname: + aap_hostname: default: None required: false description: URL to the Ansible Controller Server. type: str - controller_validate_certs: + aap_validate_certs: default: true required: false description: Whether or not to validate the Ansible Controller Server's SSL certificate. type: str - controller_username: + aap_username: default: None required: false description: Admin User on the Ansible Controller Server. Either username / password or oauthtoken need to be specified. type: str - controller_password: + aap_password: default: None required: false description: Controller Admin User's password on the Ansible Controller Server. This should be stored in an Ansible Vault at vars/controller-secrets.yml or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified. type: str - controller_oauthtoken: + aap_oauthtoken: default: None required: false description: Controller Admin User's token on the Ansible Controller Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified. diff --git a/roles/filetree_create/tasks/all.yml b/roles/filetree_create/tasks/all.yml index fa7f105f..299c43ab 100644 --- a/roles/filetree_create/tasks/all.yml +++ b/roles/filetree_create/tasks/all.yml @@ -2,7 +2,7 @@ - name: "Get the Tower/AAP instance version" ansible.builtin.set_fact: aap_version: "{{ lookup(controller_api_plugin, 'ping', - host=controller_hostname, oauth_token=controller_oauthtoken, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs).version }}" - name: "Check if the connection is to an Ansible Tower or to Automation Platform" ansible.builtin.set_fact: @@ -19,7 +19,7 @@ ansible.builtin.set_fact: organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': organization_filter}, - host=controller_hostname, oauth_token=controller_oauthtoken, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs).id }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" @@ -32,54 +32,54 @@ when: "['all', 'labels', 'applications', 'instance_groups', 'settings', 'inventory', 'credentials', 'credential_types', 'notification_templates', 'users', 'teams', 'roles', 'organizations', 'projects', 'execution_environments', 'job_templates', 'workflow_job_templates', 'workflow_job_template_nodes', 'schedules'] | intersect(input_tag) | length > 0" block: - name: "Export Inventories and related Groups and Hosts" - ansible.builtin.include_tasks: "inventory.yml" + ansible.builtin.include_tasks: "controller_inventory.yml" when: "'inventory' in input_tag or 'all' in input_tag" - name: "Export Constructed Inventories" - ansible.builtin.include_tasks: "constructed_inventory.yml" + ansible.builtin.include_tasks: "controller_constructed_inventory.yml" when: "('inventory' in input_tag or 'all' in input_tag) and have_constructed" - name: "Export Credentials" - ansible.builtin.include_tasks: "credentials.yml" + ansible.builtin.include_tasks: "controller_credentials.yml" when: "'credentials' in input_tag or 'all' in input_tag" - name: "Export Credential Types" - ansible.builtin.include_tasks: "credential_types.yml" + ansible.builtin.include_tasks: "controller_credential_types.yml" when: "'credential_types' in input_tag or 'all' in input_tag" - name: "Export Notification Templates" - ansible.builtin.include_tasks: "notification_templates.yml" + ansible.builtin.include_tasks: "controller_notification_templates.yml" when: "'notification_templates' in input_tag or 'all' in input_tag" - name: "Export Users" - ansible.builtin.include_tasks: "users.yml" + ansible.builtin.include_tasks: "controller_users.yml" when: "'users' in input_tag or 'roles' in input_tag or 'all' in input_tag" - name: "Export Teams" - ansible.builtin.include_tasks: "teams.yml" + ansible.builtin.include_tasks: "controller_teams.yml" when: "'teams' in input_tag or 'roles' in input_tag or 'all' in input_tag" - name: "Export Organizations" - ansible.builtin.include_tasks: "organizations.yml" + ansible.builtin.include_tasks: "controller_organizations.yml" when: "'organizations' in input_tag or 'all' in input_tag" - name: "Export Job Templates" - ansible.builtin.include_tasks: "job_templates.yml" + ansible.builtin.include_tasks: "controller_job_templates.yml" when: "'job_templates' in input_tag or 'all' in input_tag" - name: "Export Projects" - ansible.builtin.include_tasks: "projects.yml" + ansible.builtin.include_tasks: "controller_projects.yml" when: "'projects' in input_tag or 'all' in input_tag" - name: "Export Execution Environments" - ansible.builtin.include_tasks: "execution_environments.yml" + ansible.builtin.include_tasks: "controller_execution_environments.yml" when: "('execution_environments' in input_tag or 'all' in input_tag) and is_aap" - name: "Export Workflow Job Templates" - ansible.builtin.include_tasks: "workflow_job_templates.yml" + ansible.builtin.include_tasks: "controller_workflow_job_templates.yml" when: "'workflow_job_templates' in input_tag or 'all' in input_tag" - name: "Export Settings" - ansible.builtin.include_tasks: "settings.yml" + ansible.builtin.include_tasks: "controller_settings.yml" when: "'settings' in input_tag or 'all' in input_tag" - name: "Export Instance Groups" - ansible.builtin.include_tasks: "instance_groups.yml" + ansible.builtin.include_tasks: "controller_instance_groups.yml" when: "'instance_groups' in input_tag or 'all' in input_tag" - name: "Export Applications" - ansible.builtin.include_tasks: "applications.yml" + ansible.builtin.include_tasks: "controller_applications.yml" when: "'applications' in input_tag or 'all' in input_tag" - name: "Export Labels" - ansible.builtin.include_tasks: "labels.yml" + ansible.builtin.include_tasks: "controller_labels.yml" when: "'labels' in input_tag or 'all' in input_tag" - name: "Export Schedules" - ansible.builtin.include_tasks: "schedules.yml" + ansible.builtin.include_tasks: "controller_schedules.yml" when: "'schedules' in input_tag or 'all' in input_tag" ... diff --git a/roles/filetree_create/tasks/applications.yml b/roles/filetree_create/tasks/controller_applications.yml similarity index 79% rename from roles/filetree_create/tasks/applications.yml rename to roles/filetree_create/tasks/controller_applications.yml index e53e5854..34171ceb 100644 --- a/roles/filetree_create/tasks/applications.yml +++ b/roles/filetree_create/tasks/controller_applications.yml @@ -3,7 +3,7 @@ ansible.builtin.set_fact: applications_lookvar: "{{ query(controller_api_plugin, 'applications/', query_params=(query_params | combine({'organization': organization_id})) if organization_id is defined else query_params, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: @@ -16,16 +16,16 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/applications.yaml" + __dest: "{{ output_path }}/controller_applications.yaml" block: - - name: "Add current applications to the applications flat file" + - name: "Add current applications to the controller_applications flat file" ansible.builtin.blockinfile: create: true mode: "0644" insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_applications.j2') }}" + block: "{{ lookup('template', 'templates/controller_applications.j2') }}" vars: application_organization: "{{ current_applications_asset_value.summary_fields.organization.name | default(organization, true) }}" application_id: "{{ current_applications_asset_value.id }}" @@ -46,13 +46,13 @@ - name: "Block for to generate the filetre_create normal output" when: flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the /applications output directory for applications in {{ output_path }}" + - name: "Create the /controller_applications output directory for applications in {{ output_path }}" ansible.builtin.file: path: "{{ __path }}" state: directory mode: '0755' vars: - __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/applications" + __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/controller_applications" loop: "{{ (applications_lookvar | map(attribute='summary_fields') | selectattr('organization', 'defined') | map(attribute='organization') | map(attribute='name') | list | flatten | unique) + ([organization] if ((applications_lookvar | map(attribute='summary_fields') @@ -62,16 +62,16 @@ loop_var: needed_path label: "{{ __path }}" - - name: "Add current applications to the /applications output file in {{ output_path }}" + - name: "Add current applications to the /controller_applications output file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_applications.j2" + src: "templates/controller_applications.j2" dest: "{{ __dest }}" mode: '0644' vars: application_organization: "{{ current_applications_asset_value.summary_fields.organization.name | default(organization, true) }}" application_id: "{{ current_applications_asset_value.id }}" application_name: "{{ current_applications_asset_value.name | regex_replace('/', '_') }}" - __dest: "{{ output_path }}/{{ application_organization | regex_replace('/', '_') }}/applications/{{ (application_id ~ '_') if omit_id is not defined else '' }}{{ application_name | regex_replace('/', '_') }}.yaml" + __dest: "{{ output_path }}/{{ application_organization | regex_replace('/', '_') }}/controller_applications/{{ (application_id ~ '_') if omit_id is not defined else '' }}{{ application_name | regex_replace('/', '_') }}.yaml" loop: "{{ applications_lookvar }}" loop_control: loop_var: current_applications_asset_value diff --git a/roles/filetree_create/tasks/constructed_inventory.yml b/roles/filetree_create/tasks/controller_constructed_inventory.yml similarity index 77% rename from roles/filetree_create/tasks/constructed_inventory.yml rename to roles/filetree_create/tasks/controller_constructed_inventory.yml index 6e5c6910..8c96c3b2 100644 --- a/roles/filetree_create/tasks/constructed_inventory.yml +++ b/roles/filetree_create/tasks/controller_constructed_inventory.yml @@ -1,9 +1,9 @@ --- - name: "Get the constructed inventories from the API" ansible.builtin.set_fact: - constructed_inventory_lookvar: "{{ query(controller_api_plugin, 'api/v2/constructed_inventories/', + constructed_inventory_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/constructed_inventories/', query_params=(query_params | combine({'organization': organization_id})) if organization_id is defined else query_params, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: @@ -16,7 +16,7 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/inventories.yaml" + __dest: "{{ output_path }}/controller_inventories.yaml" block: - name: "Stat if the output file exists" ansible.builtin.stat: @@ -30,14 +30,14 @@ state: absent when: __constructed_inventories_file.stat.exists | bool - - name: "Add current constructed inventory to the inventories flat file" + - name: "Add current constructed inventory to the controller_inventories flat file" ansible.builtin.blockinfile: create: true mode: "0644" insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_inventories.j2') }}" + block: "{{ lookup('template', 'templates/controller_inventories.j2') }}" vars: inventory_organization: "{{ current_inventories_asset_value.summary_fields.organization.name | default(organization) }}" inventory_name: "{{ current_inventories_asset_value.name | regex_replace('/', '_') }}" @@ -58,7 +58,7 @@ - name: "Block for to generate the filetre_create normal output" when: flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the /inventories output directory for inventories in {{ output_path }}" + - name: "Create the /controller_inventories output directory for inventories in {{ output_path }}" ansible.builtin.file: path: "{{ __path }}" state: directory @@ -66,21 +66,21 @@ vars: inventory_organization: "{{ needed_path.summary_fields.organization.name | default(organization) }}" inventory_name: "{{ needed_path.name | regex_replace('/', '_') }}" - __path: "{{ output_path }}/{{ inventory_organization | regex_replace('/', '_') }}/inventories/{{ inventory_name | regex_replace('/', '_') }}" + __path: "{{ output_path }}/{{ inventory_organization | regex_replace('/', '_') }}/controller_inventories/{{ inventory_name | regex_replace('/', '_') }}" loop: "{{ constructed_inventory_lookvar }}" loop_control: loop_var: needed_path label: "{{ __path }}" - - name: "Add current constructed_inventories to the /inventories output yaml file in {{ output_path }}" + - name: "Add current constructed_inventories to the /controller_inventories output yaml file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_inventories.j2" + src: "templates/controller_inventories.j2" dest: "{{ __dest }}" mode: '0644' vars: inventory_organization: "{{ current_inventories_asset_value.summary_fields.organization.name | default(organization) }}" inventory_name: "{{ current_inventories_asset_value.name | regex_replace('/', '_') }}" - __dest: "{{ output_path }}/{{ inventory_organization | regex_replace('/', '_') }}/inventories/{{ inventory_name | regex_replace('/', '_') }}/{{ (current_inventories_asset_value.id ~ '_') if omit_id is not defined else '' }}{{ inventory_name | regex_replace('/', '_') }}.yaml" + __dest: "{{ output_path }}/{{ inventory_organization | regex_replace('/', '_') }}/controller_inventories/{{ inventory_name | regex_replace('/', '_') }}/{{ (current_inventories_asset_value.id ~ '_') if omit_id is not defined else '' }}{{ inventory_name | regex_replace('/', '_') }}.yaml" loop: "{{ constructed_inventory_lookvar }}" loop_control: loop_var: current_inventories_asset_value diff --git a/roles/filetree_create/tasks/credential_types.yml b/roles/filetree_create/tasks/controller_credential_types.yml similarity index 69% rename from roles/filetree_create/tasks/credential_types.yml rename to roles/filetree_create/tasks/controller_credential_types.yml index ac029153..83fc62ac 100644 --- a/roles/filetree_create/tasks/credential_types.yml +++ b/roles/filetree_create/tasks/controller_credential_types.yml @@ -1,9 +1,9 @@ --- - name: "Get current Credential Types from the API when AAP" ansible.builtin.set_fact: - credential_types_lookvar: "{{ query(controller_api_plugin, 'api/v2/credential_types/', + credential_types_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/credential_types/', query_params={'managed': false}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" @@ -11,9 +11,9 @@ - name: "Get current Credential Types from the API when Tower" ansible.builtin.set_fact: - credential_types_lookvar: "{{ query(controller_api_plugin, 'api/v2/credential_types/', + credential_types_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/credential_types/', query_params={'managed_by_tower': false}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" @@ -25,10 +25,10 @@ state: directory mode: '0755' -- name: "Add current credential types to the current_credential_types.yaml output file in {{ output_path }}" +- name: "Add current credential types to the credential_types.yaml output file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_credential_types.j2" - dest: "{{ output_path }}/current_credential_types.yaml" + src: "templates/controller_credential_types.j2" + dest: "{{ output_path }}/controller_credential_types.yaml" mode: '0644' vars: current_credential_types_asset_value: "{{ credential_types_lookvar }}" diff --git a/roles/filetree_create/tasks/credentials.yml b/roles/filetree_create/tasks/controller_credentials.yml similarity index 76% rename from roles/filetree_create/tasks/credentials.yml rename to roles/filetree_create/tasks/controller_credentials.yml index 5848c5fc..7522a3aa 100644 --- a/roles/filetree_create/tasks/credentials.yml +++ b/roles/filetree_create/tasks/controller_credentials.yml @@ -1,9 +1,9 @@ --- - name: "Get current Credentials from the API" ansible.builtin.set_fact: - credentials_lookvar: "{{ query(controller_api_plugin, 'api/v2/credentials/', + credentials_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/credentials/', query_params=(query_params | combine({'organization': organization_id})) if organization_id is defined else query_params, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: @@ -16,16 +16,16 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/credentials.yaml" + __dest: "{{ output_path }}/controller_credentials.yaml" block: - - name: "Add current credentials to the credentials flat file" + - name: "Add current credentials to the controller_credentials flat file" ansible.builtin.blockinfile: create: true mode: "0644" insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_credentials.j2') }}" + block: "{{ lookup('template', 'templates/controller_credentials.j2') }}" vars: credentials_organization: "{{ current_credentials_asset_value.summary_fields.organization.name | default(organization) }}" credentials_id: "{{ current_credentials_asset_value.id }}" @@ -46,13 +46,13 @@ - name: "Block for to generate the filetre_create normal output" when: flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the /credentials output directory for credentials in {{ output_path }}" + - name: "Create the /controller_credentials output directory for credentials in {{ output_path }}" ansible.builtin.file: path: "{{ __path }}" state: directory mode: '0755' vars: - __path: "{{ output_path }}/{{ needed_path }}/credentials" + __path: "{{ output_path }}/{{ needed_path }}/controller_credentials" loop: "{{ (credentials_lookvar | map(attribute='summary_fields') | selectattr('organization', 'defined') | map(attribute='organization') | map(attribute='name') | list | flatten | unique) + ([organization] if ((credentials_lookvar | @@ -62,16 +62,16 @@ loop_var: needed_path label: "{{ __path }}" - - name: "Add current credentials to the /credentials output yaml file in {{ output_path }}" + - name: "Add current credentials to the /controller_credentials output yaml file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_credentials.j2" + src: "templates/controller_credentials.j2" dest: "{{ __dest }}" mode: '0644' vars: credentials_organization: "{{ current_credentials_asset_value.summary_fields.organization.name | default(organization) }}" credentials_id: "{{ current_credentials_asset_value.id }}" credentials_name: "{{ current_credentials_asset_value.name | regex_replace('/', '_') }}" - __dest: "{{ output_path }}/{{ credentials_organization | regex_replace('/', '_') }}/credentials/{{ (credentials_id ~ '_') if omit_id is not defined else '' }}{{ credentials_name | regex_replace('/', '_') }}.yaml" + __dest: "{{ output_path }}/{{ credentials_organization | regex_replace('/', '_') }}/controller_credentials/{{ (credentials_id ~ '_') if omit_id is not defined else '' }}{{ credentials_name | regex_replace('/', '_') }}.yaml" loop: "{{ credentials_lookvar }}" loop_control: loop_var: current_credentials_asset_value diff --git a/roles/filetree_create/tasks/execution_environments.yml b/roles/filetree_create/tasks/controller_execution_environments.yml similarity index 68% rename from roles/filetree_create/tasks/execution_environments.yml rename to roles/filetree_create/tasks/controller_execution_environments.yml index 55d4118d..6ade9e54 100644 --- a/roles/filetree_create/tasks/execution_environments.yml +++ b/roles/filetree_create/tasks/controller_execution_environments.yml @@ -1,9 +1,9 @@ --- - name: "Get current Execution Environments from the API" ansible.builtin.set_fact: - execution_environments_lookvar: "{{ query(controller_api_plugin, 'api/v2/execution_environments/', + execution_environments_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/execution_environments/', query_params=(query_params | combine({'organization': organization_id})) if organization_id is defined else query_params, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: @@ -17,10 +17,10 @@ state: directory mode: '0755' -- name: "Add current execution environments to the current_execution_environments.yaml output file in {{ output_path }}" +- name: "Add current execution environments to the execution_environments.yaml output file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_execution_environments.j2" - dest: "{{ output_path }}/current_execution_environments.yaml" + src: "templates/controller_execution_environments.j2" + dest: "{{ output_path }}/controller_execution_environments.yaml" mode: '0644' vars: current_execution_environments_asset_value: "{{ execution_environments_lookvar }}" diff --git a/roles/filetree_create/tasks/groups.yml b/roles/filetree_create/tasks/controller_groups.yml similarity index 83% rename from roles/filetree_create/tasks/groups.yml rename to roles/filetree_create/tasks/controller_groups.yml index 6b94ec3d..6c0f3775 100644 --- a/roles/filetree_create/tasks/groups.yml +++ b/roles/filetree_create/tasks/controller_groups.yml @@ -26,7 +26,7 @@ insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_groups.j2') }}" + block: "{{ lookup('template', 'templates/controller_groups.j2') }}" vars: first_group: "{{ not (__groups_file.stat.exists | bool) }}" @@ -45,10 +45,10 @@ state: directory mode: '0755' - - name: "Add current groups to the current_groups.yaml output file in {{ groups_output_path }}" + - name: "Add current groups to the controller_groups.yaml output file in {{ groups_output_path }}" ansible.builtin.template: - src: "templates/current_groups.j2" - dest: "{{ groups_output_path }}/current_groups.yaml" + src: "templates/controller_groups.j2" + dest: "{{ groups_output_path }}/controller_groups.yaml" mode: '0644' when: current_groups_asset_value | length > 0 ... diff --git a/roles/filetree_create/tasks/hosts.yml b/roles/filetree_create/tasks/controller_hosts.yml similarity index 80% rename from roles/filetree_create/tasks/hosts.yml rename to roles/filetree_create/tasks/controller_hosts.yml index ca320ccc..b801b5bd 100644 --- a/roles/filetree_create/tasks/hosts.yml +++ b/roles/filetree_create/tasks/controller_hosts.yml @@ -19,14 +19,14 @@ state: absent when: __hosts_file.stat.exists | bool - - name: "Add current hosts to the hosts flat file" + - name: "Add current hosts to the controller_hosts flat file" ansible.builtin.blockinfile: create: true mode: "0644" insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_hosts.j2') }}" + block: "{{ lookup('template', 'templates/controller_hosts.j2') }}" vars: first_group: "{{ not (__hosts_file.stat.exists | bool) }}" @@ -45,10 +45,10 @@ state: directory mode: '0755' - - name: "Add current hosts to the current_hosts.yaml output file in {{ hosts_output_path }}" + - name: "Add current hosts to the controller_hosts.yaml output file in {{ hosts_output_path }}" ansible.builtin.template: - src: "templates/current_hosts.j2" - dest: "{{ hosts_output_path }}/current_hosts.yaml" + src: "templates/controller_hosts.j2" + dest: "{{ hosts_output_path }}/controller_hosts.yaml" mode: '0644' when: current_hosts_asset_value | length > 0 ... diff --git a/roles/filetree_create/tasks/instance_groups.yml b/roles/filetree_create/tasks/controller_instance_groups.yml similarity index 63% rename from roles/filetree_create/tasks/instance_groups.yml rename to roles/filetree_create/tasks/controller_instance_groups.yml index 41657a06..76f6fb1d 100644 --- a/roles/filetree_create/tasks/instance_groups.yml +++ b/roles/filetree_create/tasks/controller_instance_groups.yml @@ -1,8 +1,8 @@ --- - name: "Get current Instance Groups from the API" ansible.builtin.set_fact: - instance_groups_lookvar: "{{ query(controller_api_plugin, 'api/v2/instance_groups/', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + instance_groups_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/instance_groups/', + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" @@ -13,10 +13,10 @@ state: directory mode: '0755' -- name: "Add current instance groups to the current_instance_groups.yaml output file in {{ output_path }}" +- name: "Add current instance groups to the controller_instance_groups.yaml output file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_instance_groups.j2" - dest: "{{ output_path }}/current_instance_groups.yaml" + src: "templates/controller_instance_groups.j2" + dest: "{{ output_path }}/controller_instance_groups.yaml" mode: '0644' vars: current_instance_groups_asset_value: "{{ instance_groups_lookvar }}" diff --git a/roles/filetree_create/tasks/inventory.yml b/roles/filetree_create/tasks/controller_inventory.yml similarity index 79% rename from roles/filetree_create/tasks/inventory.yml rename to roles/filetree_create/tasks/controller_inventory.yml index 69dd6205..d7e9cf75 100644 --- a/roles/filetree_create/tasks/inventory.yml +++ b/roles/filetree_create/tasks/controller_inventory.yml @@ -1,10 +1,10 @@ --- - name: "Get the inventories from the API" ansible.builtin.set_fact: - inventory_lookvar: "{{ query(controller_api_plugin, 'api/v2/inventories/', + inventory_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/inventories/', query_params=(query_params | combine({'organization': organization_id} if organization_id is defined else {}, {'id': inventory_id} if inventory_id is defined else {})), - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: @@ -18,7 +18,7 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/inventories.yaml" + __dest: "{{ output_path }}/controller_inventories.yaml" block: - name: "Stat if the output file exists" ansible.builtin.stat: @@ -39,7 +39,7 @@ insertafter: EOF path: "{{ __dest }}" marker: '' - block: "{{ lookup('template', 'templates/current_inventories.j2') }}" + block: "{{ lookup('template', 'templates/controller_inventories.j2') }}" vars: inventory_organization: "{{ current_inventories_asset_value.summary_fields.organization.name | default(organization) }}" inventory_name: "{{ current_inventories_asset_value.name | regex_replace('/', '_') }}" @@ -60,7 +60,7 @@ - name: "Block for to generate the filetre_create normal output" when: flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the /inventories output directory for inventories in {{ output_path }}" + - name: "Create the /controller_inventories output directory for inventories in {{ output_path }}" ansible.builtin.file: path: "{{ __path }}" state: directory @@ -68,38 +68,38 @@ vars: inventory_organization: "{{ needed_path.summary_fields.organization.name | default(organization) }}" inventory_name: "{{ needed_path.name | regex_replace('/', '_') }}" - __path: "{{ output_path }}/{{ inventory_organization | regex_replace('/', '_') }}/inventories/{{ inventory_name | regex_replace('/', '_') }}" + __path: "{{ output_path }}/{{ inventory_organization | regex_replace('/', '_') }}/controller_inventories/{{ inventory_name | regex_replace('/', '_') }}" loop: "{{ inventory_lookvar }}" loop_control: loop_var: needed_path label: "{{ __path }}" - - name: "Add current inventories to the /inventories output yaml file in {{ output_path }}" + - name: "Add current inventories to the /controller_inventories output yaml file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_inventories.j2" + src: "templates/controller_inventories.j2" dest: "{{ __dest }}" mode: '0644' vars: inventory_organization: "{{ current_inventories_asset_value.summary_fields.organization.name | default(organization) }}" inventory_name: "{{ current_inventories_asset_value.name | regex_replace('/', '_') }}" - __dest: "{{ output_path }}/{{ inventory_organization | regex_replace('/', '_') }}/inventories/{{ inventory_name | regex_replace('/', '_') }}/{{ (current_inventories_asset_value.id ~ '_') if omit_id is not defined else '' }}{{ inventory_name | regex_replace('/', '_') }}.yaml" + __dest: "{{ output_path }}/{{ inventory_organization | regex_replace('/', '_') }}/controller_inventories/{{ inventory_name | regex_replace('/', '_') }}/{{ (current_inventories_asset_value.id ~ '_') if omit_id is not defined else '' }}{{ inventory_name | regex_replace('/', '_') }}.yaml" loop: "{{ inventory_lookvar }}" loop_control: loop_var: current_inventories_asset_value label: "{{ __dest }}" - name: "Set the inventory's inventory sources" - ansible.builtin.include_tasks: "inventory_sources.yml" + ansible.builtin.include_tasks: "controller_inventory_sources.yml" when: current_inventory_sources.total_inventory_sources > 0 and not skip_inventory_sources vars: inventory_organization: "{{ current_inventory_sources.summary_fields.organization.name | default(organization) }}" inventory_name: "{{ current_inventory_sources.name | regex_replace('/', '_') }}" - inventory_sources_output_path: "{{ (output_path + '/' + inventory_organization | regex_replace('/', '_') + '/inventories/' + inventory_name | regex_replace('/', '_')) + inventory_sources_output_path: "{{ (output_path + '/' + inventory_organization | regex_replace('/', '_') + '/controller_inventories/' + inventory_name | regex_replace('/', '_')) if (flatten_output is not defined or (flatten_output | bool) == false) else output_path + '/inventory_sources.yaml' }}" current_inventory_sources_asset_value: "{{ query(controller_api_plugin, current_inventory_sources.related.inventory_sources, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) if current_inventory_sources.has_inventory_sources else [] }}" @@ -112,18 +112,18 @@ no_log: "{{ controller_configuration_filetree_create_secure_logging }}" - name: "Set the inventory's hosts" - ansible.builtin.include_tasks: "hosts.yml" + ansible.builtin.include_tasks: "controller_hosts.yml" when: not skip_inventory_hosts vars: inventory_organization: "{{ current_inventory_hosts.summary_fields.organization.name | default(organization) }}" inventory_name: "{{ current_inventory_hosts.name | regex_replace('/', '_') }}" - hosts_output_path: "{{ (output_path + '/' + inventory_organization | regex_replace('/', '_') + '/inventories/' + inventory_name | regex_replace('/', '_')) + hosts_output_path: "{{ (output_path + '/' + inventory_organization | regex_replace('/', '_') + '/controller_inventories/' + inventory_name | regex_replace('/', '_')) if (flatten_output is not defined or (flatten_output | bool) == false) else - output_path + '/hosts.yaml' }}" + output_path + '/controller_hosts.yaml' }}" current_hosts_asset_value: "{{ query(controller_api_plugin, current_inventory_hosts.related.hosts, query_params={'not__description': 'imported'}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) if not current_inventory_hosts.has_inventory_sources else [] }}" @@ -135,18 +135,18 @@ no_log: "{{ controller_configuration_filetree_create_secure_logging }}" - name: "Set the inventory's groups" - ansible.builtin.include_tasks: "groups.yml" + ansible.builtin.include_tasks: "controller_groups.yml" when: current_inventory_groups.total_groups > 0 and not skip_inventory_groups vars: inventory_organization: "{{ current_inventory_groups.summary_fields.organization.name | default(organization) }}" inventory_name: "{{ current_inventory_groups.name | regex_replace('/', '_') }}" - groups_output_path: "{{ (output_path + '/' + inventory_organization | regex_replace('/', '_') + '/inventories/' + inventory_name | regex_replace('/', '_')) + groups_output_path: "{{ (output_path + '/' + inventory_organization | regex_replace('/', '_') + '/controller_inventories/' + inventory_name | regex_replace('/', '_')) if (flatten_output is not defined or (flatten_output | bool) == false) else output_path + '/groups.yaml' }}" current_groups_asset_value: "{{ query(controller_api_plugin, current_inventory_groups.related.groups, query_params={'not__description': 'imported'}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) if (not current_inventory_groups.has_inventory_sources or current_inventory_groups.kind is match('smart')) else [] }}" diff --git a/roles/filetree_create/tasks/inventory_sources.yml b/roles/filetree_create/tasks/controller_inventory_sources.yml similarity index 82% rename from roles/filetree_create/tasks/inventory_sources.yml rename to roles/filetree_create/tasks/controller_inventory_sources.yml index 899fc0b3..d0caf2e3 100644 --- a/roles/filetree_create/tasks/inventory_sources.yml +++ b/roles/filetree_create/tasks/controller_inventory_sources.yml @@ -25,7 +25,7 @@ insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_inventory_sources.j2') }}" + block: "{{ lookup('template', 'templates/controller_inventory_sources.j2') }}" vars: first_inventory_source: "{{ not (__inventory_sources_file.stat.exists | bool) }}" last_inventory_source: "{{ current_inventory_for_sources_index == ((inventory_lookvar | length) - 1) }}" @@ -45,10 +45,10 @@ state: directory mode: '0755' - - name: "Add current inventory source to the current_inventory_sources.yaml output file in {{ inventory_sources_output_path }}" + - name: "Add current inventory source to the inventory_sources.yaml output file in {{ inventory_sources_output_path }}" ansible.builtin.template: - src: "templates/current_inventory_sources.j2" - dest: "{{ inventory_sources_output_path }}/current_inventory_sources.yaml" + src: "templates/controller_inventory_sources.j2" + dest: "{{ inventory_sources_output_path }}/controller_inventory_sources.yaml" mode: '0644' when: - current_inventory_sources_asset_value | length > 0 diff --git a/roles/filetree_create/tasks/job_templates.yml b/roles/filetree_create/tasks/controller_job_templates.yml similarity index 76% rename from roles/filetree_create/tasks/job_templates.yml rename to roles/filetree_create/tasks/controller_job_templates.yml index 3f4190ed..7e5bb488 100644 --- a/roles/filetree_create/tasks/job_templates.yml +++ b/roles/filetree_create/tasks/controller_job_templates.yml @@ -1,11 +1,11 @@ --- - name: "Get current Job Templates from the API" ansible.builtin.set_fact: - job_templates_lookvar: "{{ query(controller_api_plugin, 'api/v2/job_templates/', + job_templates_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/job_templates/', query_params=(query_params | combine({'organization': organization_id} if organization_id is defined else {}, {'project': project_id} if project_id is defined else {}, {'id': job_template_id} if job_template_id is defined else {})), - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: @@ -27,7 +27,7 @@ related_project_id: "{{ project_id }}" - name: "Export project related to job template" - ansible.builtin.include_tasks: "projects.yml" + ansible.builtin.include_tasks: "controller_projects.yml" vars: project_id: "{{ related_project_id }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" @@ -37,31 +37,31 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/job_templates.yaml" + __dest: "{{ output_path }}/controller_job_templates.yaml" block: - - name: "Add current job_templates to the job_templates flat file" + - name: "Add current job_templates to the controller_job_templates flat file" ansible.builtin.blockinfile: create: true mode: "0644" insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_job_templates.j2') }}" + block: "{{ lookup('template', 'templates/controller_job_templates.j2') }}" vars: job_template_organization: "{{ current_job_templates_asset_value.summary_fields.organization.name | default(organization) }}" job_template_id: "{{ current_job_templates_asset_value.id }}" job_template_name: "{{ current_job_templates_asset_value.name | regex_replace('/', '_') }}" query_labels: "{{ query(controller_api_plugin, current_job_templates_asset_value.related.labels, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_error: "{{ query(controller_api_plugin, current_job_templates_asset_value.related.notification_templates_error, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_started: "{{ query(controller_api_plugin, current_job_templates_asset_value.related.notification_templates_started, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_success: "{{ query(controller_api_plugin, current_job_templates_asset_value.related.notification_templates_success, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" last_job_template: "{{ current_job_template_index == ((job_templates_lookvar | length) - 1) }}" loop: "{{ job_templates_lookvar }}" @@ -80,13 +80,13 @@ - name: "Block for to generate the filetre_create normal output" when: flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the output directories for job templates in {{ output_path }}" + - name: "Create the /controller_job_templates output directories for job templates in {{ output_path }}" ansible.builtin.file: path: "{{ __path }}" state: directory mode: '0755' vars: - __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/job_templates" + __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/controller_job_templates" loop: "{{ (job_templates_lookvar | map(attribute='summary_fields') | selectattr('organization', 'defined') | map(attribute='organization') | map(attribute='name') | list | flatten | unique) + ([organization] if ((job_templates_lookvar | map(attribute='summary_fields') | @@ -96,27 +96,27 @@ loop_var: needed_path label: "{{ __path }}" - - name: "Add current job_templates to the /job_templates output file in {{ output_path }}" + - name: "Add current job_templates to the /controller_job_templates output file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_job_templates.j2" + src: "templates/controller_job_templates.j2" dest: "{{ __dest }}" mode: '0644' vars: job_template_organization: "{{ current_job_templates_asset_value.summary_fields.organization.name | default(organization) }}" job_template_id: "{{ current_job_templates_asset_value.id }}" job_template_name: "{{ current_job_templates_asset_value.name | regex_replace('/', '_') }}" - __dest: "{{ output_path }}/{{ job_template_organization | regex_replace('/', '_') }}/job_templates/{{ (job_template_id ~ '_') if omit_id is not defined else '' }}{{ job_template_name | regex_replace('/', '_') }}.yaml" + __dest: "{{ output_path }}/{{ job_template_organization | regex_replace('/', '_') }}/controller_job_templates/{{ (job_template_id ~ '_') if omit_id is not defined else '' }}{{ job_template_name | regex_replace('/', '_') }}.yaml" query_labels: "{{ query(controller_api_plugin, current_job_templates_asset_value.related.labels, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_error: "{{ query(controller_api_plugin, current_job_templates_asset_value.related.notification_templates_error, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_started: "{{ query(controller_api_plugin, current_job_templates_asset_value.related.notification_templates_started, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_success: "{{ query(controller_api_plugin, current_job_templates_asset_value.related.notification_templates_success, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" loop: "{{ job_templates_lookvar }}" loop_control: diff --git a/roles/filetree_create/tasks/labels.yml b/roles/filetree_create/tasks/controller_labels.yml similarity index 76% rename from roles/filetree_create/tasks/labels.yml rename to roles/filetree_create/tasks/controller_labels.yml index 2eef9ac5..45d35bda 100644 --- a/roles/filetree_create/tasks/labels.yml +++ b/roles/filetree_create/tasks/controller_labels.yml @@ -1,9 +1,9 @@ --- - name: "Get current Labels from the API" ansible.builtin.set_fact: - labels_lookvar: "{{ query(controller_api_plugin, 'api/v2/labels/', + labels_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/labels/', query_params=(query_params | combine({'organization': organization_id})) if organization_id is defined else query_params, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: @@ -16,16 +16,16 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/labels.yaml" + __dest: "{{ output_path }}/controller_labels.yaml" block: - - name: "Add current labels to the labels flat file" + - name: "Add current labels to the controller_labels flat file" ansible.builtin.blockinfile: create: true mode: "0644" insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_labels.j2') }}" + block: "{{ lookup('template', 'templates/controller_labels.j2') }}" vars: label_organization: "{{ current_labels_asset_value.summary_fields.organization.name | default('ORGANIZATIONLESS', true) }}" label_id: "{{ current_labels_asset_value.id }}" @@ -46,13 +46,13 @@ - name: "Block for to generate the filetre_create normal output" when: flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the /labels output directory for labels in {{ output_path }}" + - name: "Create the /controller_labels output directory for labels in {{ output_path }}" ansible.builtin.file: path: "{{ __path }}" state: directory mode: '0755' vars: - __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/labels" + __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/controller_labels" loop: "{{ (labels_lookvar | map(attribute='summary_fields') | selectattr('organization', 'defined') | map(attribute='organization') | map(attribute='name') | list | flatten | unique) + ([organization] if ((labels_lookvar | map(attribute='summary_fields') | selectattr('organization', 'undefined') | list | flatten) | length > 0) else []) }}" @@ -60,16 +60,16 @@ loop_var: needed_path label: "{{ __path }}" - - name: "Add current labels to the /labels output file in {{ output_path }}" + - name: "Add current labels to the /controller_labels output file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_labels.j2" + src: "templates/controller_labels.j2" dest: "{{ __dest }}" mode: '0644' vars: label_organization: "{{ current_labels_asset_value.summary_fields.organization.name | default(organization, true) }}" label_id: "{{ current_labels_asset_value.id }}" label_name: "{{ current_labels_asset_value.name | regex_replace('/', '_') }}" - __dest: "{{ output_path }}/{{ label_organization | regex_replace('/', '_') }}/labels/{{ (label_id ~ '_') if omit_id is not defined else '' }}{{ label_name | regex_replace('/', '_') }}.yaml" + __dest: "{{ output_path }}/{{ label_organization | regex_replace('/', '_') }}/controller_labels/{{ (label_id ~ '_') if omit_id is not defined else '' }}{{ label_name | regex_replace('/', '_') }}.yaml" loop: "{{ labels_lookvar }}" loop_control: loop_var: current_labels_asset_value diff --git a/roles/filetree_create/tasks/notification_templates.yml b/roles/filetree_create/tasks/controller_notification_templates.yml similarity index 74% rename from roles/filetree_create/tasks/notification_templates.yml rename to roles/filetree_create/tasks/controller_notification_templates.yml index 04af115c..24f04365 100644 --- a/roles/filetree_create/tasks/notification_templates.yml +++ b/roles/filetree_create/tasks/controller_notification_templates.yml @@ -1,9 +1,9 @@ --- - name: "Get current Notification Templates from the API" ansible.builtin.set_fact: - notification_templates_lookvar: "{{ query(controller_api_plugin, 'api/v2/notification_templates/', + notification_templates_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/notification_templates/', query_params=(query_params | combine({'organization': organization_id})) if organization_id is defined else query_params, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: @@ -16,16 +16,16 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/notification_templates.yaml" + __dest: "{{ output_path }}/controller_notification_templates.yaml" block: - - name: "Add current notification_templates to the notification_templates flat file" + - name: "Add current notification_templates to the controller_notification_templates flat file" ansible.builtin.blockinfile: create: true mode: "0644" insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_notification_templates.j2') }}" + block: "{{ lookup('template', 'templates/controller_notification_templates.j2') }}" vars: last_notification_template: "{{ current_notification_template_index == ((notification_templates_lookvar | length) - 1) }}" loop: "{{ notification_templates_lookvar }}" @@ -43,13 +43,13 @@ - name: "Block for to generate the filetre_create normal output" when: flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the /notification_templates output directory for notification templates in {{ output_path }}" + - name: "Create the /controller_notification_templates output directory for notification templates in {{ output_path }}" ansible.builtin.file: path: "{{ __path }}" state: directory mode: '0755' vars: - __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/notification_templates" + __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/controller_notification_templates" loop: "{{ (notification_templates_lookvar | map(attribute='summary_fields') | selectattr('organization', 'defined') | map(attribute='organization') | map(attribute='name') | list | flatten | unique) + ([organization] if ((notification_templates_lookvar | map(attribute='summary_fields') | @@ -59,13 +59,13 @@ loop_var: needed_path label: "{{ __path }}" - - name: "Add current notification templates to the /current_notification_templates.yaml output file in {{ output_path }}" + - name: "Add current notification templates to the /controller_notification_templates.yaml output file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_notification_templates.j2" + src: "templates/controller_notification_templates.j2" dest: "{{ __dest }}" mode: '0644' vars: - __dest: "{{ output_path }}/{{ (current_notification_templates_asset_value.summary_fields.organization.name | default(organization, true)) | regex_replace('/', '_') }}/notification_templates/{{ current_notification_templates_asset_value.name | regex_replace('/', '_') }}.yaml" + __dest: "{{ output_path }}/{{ (current_notification_templates_asset_value.summary_fields.organization.name | default(organization, true)) | regex_replace('/', '_') }}/controller_notification_templates/{{ current_notification_templates_asset_value.name | regex_replace('/', '_') }}.yaml" loop: "{{ notification_templates_lookvar }}" loop_control: loop_var: current_notification_templates_asset_value diff --git a/roles/filetree_create/tasks/organizations.yml b/roles/filetree_create/tasks/controller_organizations.yml similarity index 74% rename from roles/filetree_create/tasks/organizations.yml rename to roles/filetree_create/tasks/controller_organizations.yml index f2de44b6..23d5aca9 100644 --- a/roles/filetree_create/tasks/organizations.yml +++ b/roles/filetree_create/tasks/controller_organizations.yml @@ -1,9 +1,9 @@ --- - name: "Get current Organizations from the API" ansible.builtin.set_fact: - orgs_lookvar: "{{ query(controller_api_plugin, 'api/v2/organizations/', + orgs_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/organizations/', query_params=(query_params | combine({'id': organization_id})) if organization_id is defined else query_params, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: @@ -16,7 +16,7 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/organizations.yaml" + __dest: "{{ output_path }}/controller_organizations.yaml" block: - name: "Add current organizations to the organizations flat file" ansible.builtin.blockinfile: @@ -25,19 +25,19 @@ insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_organizations.j2') }}" + block: "{{ lookup('template', 'templates/controller_organizations.j2') }}" vars: query_notification_error: "{{ query(controller_api_plugin, current_organization.related.notification_templates_error, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_started: "{{ query(controller_api_plugin, current_organization.related.notification_templates_started, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_success: "{{ query(controller_api_plugin, current_organization.related.notification_templates_success, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_approvals: "{{ query(controller_api_plugin, current_organization.related.notification_templates_approvals, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" last_organization: "{{ current_organization_index == ((orgs_lookvar | length) - 1) }}" loop: "{{ orgs_lookvar }}" @@ -70,22 +70,22 @@ - name: "Add current organizations to the output yaml file" ansible.builtin.template: - src: "templates/current_organizations.j2" + src: "templates/controller_organizations.j2" dest: "{{ __dest }}" mode: '0644' vars: - __dest: "{{ output_path }}/{{ current_organization.name | regex_replace('/', '_') }}/current_organization.yaml" + __dest: "{{ output_path }}/{{ current_organization.name | regex_replace('/', '_') }}/controller_organization.yaml" query_notification_error: "{{ query(controller_api_plugin, current_organization.related.notification_templates_error, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_started: "{{ query(controller_api_plugin, current_organization.related.notification_templates_started, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_success: "{{ query(controller_api_plugin, current_organization.related.notification_templates_success, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_approvals: "{{ query(controller_api_plugin, current_organization.related.notification_templates_approvals, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" loop: "{{ orgs_lookvar }}" loop_control: diff --git a/roles/filetree_create/tasks/projects.yml b/roles/filetree_create/tasks/controller_projects.yml similarity index 74% rename from roles/filetree_create/tasks/projects.yml rename to roles/filetree_create/tasks/controller_projects.yml index 0c335827..1a3a6834 100644 --- a/roles/filetree_create/tasks/projects.yml +++ b/roles/filetree_create/tasks/controller_projects.yml @@ -1,10 +1,10 @@ --- - name: "Get current Projects from the API" ansible.builtin.set_fact: - projects_lookvar: "{{ query(controller_api_plugin, 'api/v2/projects/', + projects_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/projects/', query_params=(query_params | combine({'organization': organization_id} if organization_id is defined else {}, {'id': project_id} if project_id is defined else {})), - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: @@ -17,28 +17,28 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/projects.yaml" + __dest: "{{ output_path }}/controller_projects.yaml" block: - - name: "Add current projects to the projects flat file" + - name: "Add current projects to the controller_projects flat file" ansible.builtin.blockinfile: create: true mode: "0644" insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_projects.j2') }}" + block: "{{ lookup('template', 'templates/controller_projects.j2') }}" vars: project_organization: "{{ current_projects_asset_value.summary_fields.organization.name | default(organization, true) }}" project_id: "{{ current_projects_asset_value.id }}" project_name: "{{ current_projects_asset_value.name | regex_replace('/', '_') }}" query_notification_error: "{{ query(controller_api_plugin, current_projects_asset_value.related.notification_templates_error, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_started: "{{ query(controller_api_plugin, current_projects_asset_value.related.notification_templates_started, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_success: "{{ query(controller_api_plugin, current_projects_asset_value.related.notification_templates_success, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" last_project: "{{ current_project_index == ((projects_lookvar | length) - 1) }}" loop: "{{ projects_lookvar }}" @@ -57,13 +57,13 @@ - name: "Block for to generate the filetre_create normal output" when: flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the /projects output directory for projects in {{ output_path }}" + - name: "Create the /controller_projects output directory for projects in {{ output_path }}" ansible.builtin.file: path: "{{ __path }}" state: directory mode: '0755' vars: - __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/projects" + __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/controller_projects" loop: "{{ (projects_lookvar | map(attribute='summary_fields') | selectattr('organization', 'defined') | map(attribute='organization') | map(attribute='name') | list | flatten | unique) + ([organization] if ((projects_lookvar | map(attribute='summary_fields') | @@ -73,24 +73,24 @@ loop_var: needed_path label: "{{ __path }}" - - name: "Add current projects to the /projects output file in {{ output_path }}" + - name: "Add current projects to the /controller_projects output file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_projects.j2" + src: "templates/controller_projects.j2" dest: "{{ __dest }}" mode: '0644' vars: project_organization: "{{ current_projects_asset_value.summary_fields.organization.name | default(organization, true) }}" project_id: "{{ current_projects_asset_value.id }}" project_name: "{{ current_projects_asset_value.name | regex_replace('/', '_') }}" - __dest: "{{ output_path }}/{{ project_organization | regex_replace('/', '_') }}/projects/{{ (project_id ~ '_') if omit_id is not defined else '' }}{{ project_name | regex_replace('/', '_') }}.yaml" + __dest: "{{ output_path }}/{{ project_organization | regex_replace('/', '_') }}/controller_projects/{{ (project_id ~ '_') if omit_id is not defined else '' }}{{ project_name | regex_replace('/', '_') }}.yaml" query_notification_error: "{{ query(controller_api_plugin, current_projects_asset_value.related.notification_templates_error, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_started: "{{ query(controller_api_plugin, current_projects_asset_value.related.notification_templates_started, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_success: "{{ query(controller_api_plugin, current_projects_asset_value.related.notification_templates_success, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" loop: "{{ projects_lookvar }}" loop_control: diff --git a/roles/filetree_create/tasks/schedules.yml b/roles/filetree_create/tasks/controller_schedules.yml similarity index 69% rename from roles/filetree_create/tasks/schedules.yml rename to roles/filetree_create/tasks/controller_schedules.yml index d951b6e4..218a11bf 100644 --- a/roles/filetree_create/tasks/schedules.yml +++ b/roles/filetree_create/tasks/controller_schedules.yml @@ -1,9 +1,9 @@ --- - name: "Get current Schedules from the API" ansible.builtin.set_fact: - schedules_lookvar: "{{ query(controller_api_plugin, 'api/v2/schedules/', + schedules_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/schedules/', query_params=({'id': schedule_id} if schedule_id is defined else {}), - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" @@ -13,27 +13,27 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/schedules.yaml" + __dest: "{{ output_path }}/controller_schedules.yaml" block: - - name: "Add current schedules to the schedules flat file" + - name: "Add current schedules to the controller_schedules flat file" ansible.builtin.blockinfile: create: true mode: "0644" insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_schedules.j2') }}" + block: "{{ lookup('template', 'templates/controller_schedules.j2') }}" vars: label_id: "{{ current_schedules_asset_value.id }}" label_name: "{{ current_schedules_asset_value.name | regex_replace('/', '_') }}" query_credentials: "{{ query(controller_api_plugin, current_schedules_asset_value.related.credentials, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) if current_schedules_asset_value.related.credentials is defined else [] }}" query_instance_groups: "{{ query(controller_api_plugin, current_schedules_asset_value.related.instance_groups, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) if current_schedules_asset_value.related.instance_groups is defined else [] }}" query_labels: "{{ query(controller_api_plugin, current_schedules_asset_value.related.labels, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) if current_schedules_asset_value.related.labels is defined else [] }}" last_schedule: "{{ current_schedule_index == ((schedules_lookvar | length) - 1) }}" loop: "{{ schedules_lookvar }}" @@ -51,29 +51,29 @@ - name: "Block for to generate the filetre_create normal output" when: flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the schedules output directory for schedules in {{ output_path }}" + - name: "Create the controller_schedules output directory for schedules in {{ output_path }}" ansible.builtin.file: - path: "{{ output_path }}/schedules" + path: "{{ output_path }}/controller_schedules" state: directory mode: '0755' - - name: "Add current schedules to the schedules output file in {{ output_path }}" + - name: "Add current schedules to the controller_schedules output file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_schedules.j2" + src: "templates/controller_schedules.j2" dest: "{{ __dest }}" mode: '0644' vars: label_id: "{{ current_schedules_asset_value.id }}" label_name: "{{ current_schedules_asset_value.name | regex_replace('/', '_') }}" - __dest: "{{ output_path }}/schedules/{{ (label_id ~ '_') if omit_id is not defined else '' }}{{ label_name | regex_replace('/', '_') }}.yaml" + __dest: "{{ output_path }}/controller_schedules/{{ (label_id ~ '_') if omit_id is not defined else '' }}{{ label_name | regex_replace('/', '_') }}.yaml" query_credentials: "{{ query(controller_api_plugin, current_schedules_asset_value.related.credentials, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) if current_schedules_asset_value.related.credentials is defined else [] }}" query_instance_groups: "{{ query(controller_api_plugin, current_schedules_asset_value.related.instance_groups, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) if current_schedules_asset_value.related.instance_groups is defined else [] }}" query_labels: "{{ query(controller_api_plugin, current_schedules_asset_value.related.labels, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) if current_schedules_asset_value.related.labels is defined else [] }}" loop: "{{ schedules_lookvar }}" loop_control: diff --git a/roles/filetree_create/tasks/controller_settings.yml b/roles/filetree_create/tasks/controller_settings.yml new file mode 100644 index 00000000..8bd9782c --- /dev/null +++ b/roles/filetree_create/tasks/controller_settings.yml @@ -0,0 +1,21 @@ +--- +- name: "Get current Settings from the API" + ansible.builtin.set_fact: + changed_settings: "{{ query(controller_api_plugin, 'api/controller/v2/settings/changed/', + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, + return_all=true, max_objects=query_controller_api_max_objects) + }}" + no_log: "{{ controller_configuration_filetree_create_secure_logging }}" + +- name: "Create the output directory for controller_settings in {{ output_path }}" + ansible.builtin.file: + path: "{{ output_path }}" + state: directory + mode: '0755' + +- name: "Add current settings to the controller_settings.yaml output file in {{ output_path }}" + ansible.builtin.template: + src: "templates/controller_settings.j2" + dest: "{{ output_path }}/controller_settings.yaml" + mode: '0644' +... diff --git a/roles/filetree_create/tasks/team_access_list.yml b/roles/filetree_create/tasks/controller_team_access_list.yml similarity index 76% rename from roles/filetree_create/tasks/team_access_list.yml rename to roles/filetree_create/tasks/controller_team_access_list.yml index ff35cdc8..a6dccbb9 100644 --- a/roles/filetree_create/tasks/team_access_list.yml +++ b/roles/filetree_create/tasks/controller_team_access_list.yml @@ -6,17 +6,17 @@ - name: "Get object id from API" when: object_name is defined ansible.builtin.set_fact: - object_id: "{{ (query(controller_api_plugin, 'api/v2/' + object_type, + object_id: "{{ (query(controller_api_plugin, 'api/controller/v2/' + object_type, query_params=({'name': object_name}), - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects)).0.id }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" - name: "Get access list for object from the API" ansible.builtin.set_fact: - access_lookvar: "{{ query(controller_api_plugin, 'api/v2/' + object_type + '/' + object_id + '/access_list', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + access_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/' + object_type + '/' + object_id + '/access_list', + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" @@ -46,9 +46,9 @@ when: team_direct_access_fact | selectattr('name','equalto', item.0) | selectattr('resource_name','equalto', item.1) | map(attribute='team_name') | length > 0 loop: "{{ team_roles | product(team_objects) | list }}" -- name: "Create the output directory for team roles" +- name: "Create the output directory for controller_team roles" ansible.builtin.file: - path: "{{ output_path }}/team_roles" + path: "{{ output_path }}/controller_team_roles" state: directory mode: '0755' loop: "{{ team_roles_matrix }}" @@ -57,8 +57,8 @@ - name: "Add current roles to the output yaml file" ansible.builtin.template: - src: "templates/current_team_access_list.j2" - dest: "{{ output_path }}/team_roles/{{ team_role.resource_name | default('current') }}_roles_{{ team_role.role | regex_replace('/', '_') }}.yaml" + src: "templates/controller_team_access_list.j2" + dest: "{{ output_path }}/controller_team_roles/{{ team_role.resource_name | default('current_controller') }}_roles_{{ team_role.role | regex_replace('/', '_') }}.yaml" mode: '0644' loop: "{{ team_roles_matrix }}" loop_control: diff --git a/roles/filetree_create/tasks/team_roles.yml b/roles/filetree_create/tasks/controller_team_roles.yml similarity index 82% rename from roles/filetree_create/tasks/team_roles.yml rename to roles/filetree_create/tasks/controller_team_roles.yml index 2abe5e10..98ce06a4 100644 --- a/roles/filetree_create/tasks/team_roles.yml +++ b/roles/filetree_create/tasks/controller_team_roles.yml @@ -1,8 +1,8 @@ --- - name: "Get current Team Roles from the API" ansible.builtin.set_fact: - team_roles_lookvar: "{{ query(controller_api_plugin, 'api/v2/teams/' + teamid + '/roles/', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + team_roles_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/teams/' + teamid + '/roles/', + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" @@ -36,7 +36,7 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/team_roles.yaml" + __dest: "{{ output_path }}/controller_team_roles.yaml" block: - name: "Stat if the output file exists" ansible.builtin.stat: @@ -50,7 +50,7 @@ insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_team_roles.j2') }}" + block: "{{ lookup('template', 'templates/controller_team_roles.j2') }}" vars: first_team_role: "{{ not team_roles_file.stat.exists }}" when: object_roles | length > 0 @@ -66,7 +66,7 @@ - team_roles_lookvar | length > 0 - flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the output directory for team roles: {{ output_path }}" + - name: "Create the output directory for controller_team roles: {{ output_path }}" ansible.builtin.file: path: "{{ output_path }}/team_roles" state: directory @@ -74,8 +74,8 @@ - name: "Add current roles to the output yaml file" ansible.builtin.template: - src: "templates/current_team_roles.j2" - dest: "{{ output_path }}/team_roles/current_roles_{{ teamname | regex_replace('/', '_') }}.yaml" + src: "templates/controller_team_roles.j2" + dest: "{{ output_path }}/controller_team_roles/controller_roles_{{ teamname | regex_replace('/', '_') }}.yaml" mode: '0644' when: object_roles | length > 0 ... diff --git a/roles/filetree_create/tasks/teams.yml b/roles/filetree_create/tasks/controller_teams.yml similarity index 78% rename from roles/filetree_create/tasks/teams.yml rename to roles/filetree_create/tasks/controller_teams.yml index 5cc0079c..543e3cf1 100644 --- a/roles/filetree_create/tasks/teams.yml +++ b/roles/filetree_create/tasks/controller_teams.yml @@ -1,9 +1,9 @@ --- - name: "Get current Teams from the API" ansible.builtin.set_fact: - teams_lookvar: "{{ query(controller_api_plugin, 'api/v2/teams/', + teams_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/teams/', query_params=(query_params | combine({'organization': organization_id})) if organization_id is defined else query_params, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: @@ -16,16 +16,16 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/teams.yaml" + __dest: "{{ output_path }}/controller_teams.yaml" block: - - name: "Add current teams to the teams flat file" + - name: "Add current teams to the controller_teams flat file" ansible.builtin.blockinfile: create: true mode: "0644" insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_teams.j2') }}" + block: "{{ lookup('template', 'templates/controller_teams.j2') }}" vars: team_organization: "{{ current_teams_asset_value.summary_fields.organization.name | default(organization, true) | regex_replace('/', '_') }}" team_id: "{{ current_teams_asset_value.id }}" @@ -46,13 +46,13 @@ - name: "Block for to generate the filetre_create normal output" when: flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the /teams output directory for teams in {{ output_path }}" + - name: "Create the /controller_teams output directory for teams in {{ output_path }}" ansible.builtin.file: path: "{{ __path }}" state: directory mode: '0755' vars: - __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/teams" + __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/controller_teams" loop: "{{ (teams_lookvar | map(attribute='summary_fields') | selectattr('organization', 'defined') | map(attribute='organization') | map(attribute='name') | list | unique) + ([organization] if ((teams_lookvar | map(attribute='summary_fields') | @@ -62,23 +62,23 @@ loop_var: needed_path label: "{{ __path }}" - - name: "Add current teams to the /teams output file in {{ output_path }}" + - name: "Add current teams to the /controller_teams output file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_teams.j2" + src: "templates/controller_teams.j2" dest: "{{ __dest }}" mode: '0644' vars: team_organization: "{{ (current_teams_asset_value.summary_fields.organization.name | default(organization, true)) | regex_replace('/', '_') }}" team_id: "{{ current_teams_asset_value.id }}" team_name: "{{ current_teams_asset_value.name | regex_replace('/', '_') }}" - __dest: "{{ output_path }}/{{ team_organization | regex_replace('/', '_') }}/teams/{{ (team_id ~ '_') if omit_id is not defined else '' }}{{ team_name | regex_replace('/', '_') }}.yaml" + __dest: "{{ output_path }}/{{ team_organization | regex_replace('/', '_') }}/controller_teams/{{ (team_id ~ '_') if omit_id is not defined else '' }}{{ team_name | regex_replace('/', '_') }}.yaml" loop: "{{ teams_lookvar }}" loop_control: loop_var: current_teams_asset_value label: "{{ __dest }}" - name: "Set the team's roles" - ansible.builtin.include_tasks: "team_roles.yml" + ansible.builtin.include_tasks: "controller_team_roles.yml" vars: team_organization: "{{ (current_team.summary_fields.organization.name | default(organization, true)) | regex_replace('/', '_') }}" teamname: "{{ current_team.name }}" diff --git a/roles/filetree_create/tasks/user_access_list.yml b/roles/filetree_create/tasks/controller_user_access_list.yml similarity index 82% rename from roles/filetree_create/tasks/user_access_list.yml rename to roles/filetree_create/tasks/controller_user_access_list.yml index 71f11821..73d32224 100644 --- a/roles/filetree_create/tasks/user_access_list.yml +++ b/roles/filetree_create/tasks/controller_user_access_list.yml @@ -6,17 +6,17 @@ - name: "Get object id from API" when: object_name is defined ansible.builtin.set_fact: - object_id: "{{ (query(controller_api_plugin, 'api/v2/' + object_type, + object_id: "{{ (query(controller_api_plugin, 'api/controller/v2/' + object_type, query_params=({'name': object_name}), - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects)).0.id }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" - name: "Get access list for object from the API" ansible.builtin.set_fact: - access_lookvar: "{{ query(controller_api_plugin, 'api/v2/' + object_type + '/' + object_id + '/access_list', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + access_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/' + object_type + '/' + object_id + '/access_list', + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" @@ -59,7 +59,7 @@ - name: "Create the output directory for user roles" ansible.builtin.file: - path: "{{ output_path }}/user_roles" + path: "{{ output_path }}/controller_user_roles" state: directory mode: '0755' loop: "{{ user_roles_matrix }}" @@ -68,8 +68,8 @@ - name: "Add current roles to the output yaml file" ansible.builtin.template: - src: "templates/current_user_access_list.j2" - dest: "{{ output_path }}/user_roles/{{ user_role.resource_name | default('current') }}_roles_{{ user_role.role | regex_replace('/', '_') }}.yaml" + src: "templates/controller_user_access_list.j2" + dest: "{{ output_path }}/controller_user_roles/{{ user_role.resource_name | default('current') }}_roles_{{ user_role.role | regex_replace('/', '_') }}.yaml" mode: '0644' loop: "{{ user_roles_matrix }}" loop_control: diff --git a/roles/filetree_create/tasks/user_roles.yml b/roles/filetree_create/tasks/controller_user_roles.yml similarity index 79% rename from roles/filetree_create/tasks/user_roles.yml rename to roles/filetree_create/tasks/controller_user_roles.yml index 311d9194..dbe638c3 100644 --- a/roles/filetree_create/tasks/user_roles.yml +++ b/roles/filetree_create/tasks/controller_user_roles.yml @@ -1,13 +1,13 @@ --- - name: "Get current Users from the API" ansible.builtin.set_fact: - user_roles_lookvar: "{{ query(controller_api_plugin, 'api/v2/users/' + __user_id + '/roles/', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + user_roles_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/users/' + __user_id + '/roles/', + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: __user_id: "{{ lookup(controller_api_plugin, 'users', query_params={'username': username}, expect_one=true, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs)['id'] + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs)['id'] }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" @@ -39,7 +39,7 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/user_roles.yaml" + __dest: "{{ output_path }}/controller_user_roles.yaml" block: - name: "Stat if the output file exists" ansible.builtin.stat: @@ -53,7 +53,7 @@ insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_user_roles.j2') }}" + block: "{{ lookup('template', 'templates/controller_user_roles.j2') }}" vars: first_user_role: "{{ not user_roles_file.stat.exists }}" when: object_roles | length > 0 @@ -67,16 +67,16 @@ - name: "Block for to generate the filetre_create normal output" when: flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the output directory for user roles: {{ output_path }}" + - name: "Create the output directory for controller_user roles: {{ output_path }}" ansible.builtin.file: - path: "{{ output_path }}/user_roles" + path: "{{ output_path }}/controller_user_roles" state: directory mode: '0755' - name: "Add current roles to the output yaml file" ansible.builtin.template: - src: "templates/current_user_roles.j2" - dest: "{{ output_path }}/user_roles/current_roles_{{ username | regex_replace('/', '_') }}.yaml" + src: "templates/controller_user_roles.j2" + dest: "{{ output_path }}/controller_user_roles/controller_user_roles_{{ username | regex_replace('/', '_') }}.yaml" mode: '0644' when: object_roles | length > 0 ... diff --git a/roles/filetree_create/tasks/users.yml b/roles/filetree_create/tasks/controller_users.yml similarity index 82% rename from roles/filetree_create/tasks/users.yml rename to roles/filetree_create/tasks/controller_users.yml index fe910e99..70349d7a 100644 --- a/roles/filetree_create/tasks/users.yml +++ b/roles/filetree_create/tasks/controller_users.yml @@ -1,8 +1,8 @@ --- - name: "Get current Users from the API" ansible.builtin.set_fact: - users_lookvar: "{{ query(controller_api_plugin, 'api/v2/users/', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + users_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/users/', + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" @@ -16,7 +16,7 @@ }} vars: user_lookvar_item_organizations: "{{ query(controller_api_plugin, user_lookvar_item.related.organizations, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects ) | selectattr('name', 'defined') | map(attribute='name') }}" @@ -31,7 +31,7 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/users.yaml" + __dest: "{{ output_path }}/controller_users.yaml" block: - name: "Add current users to the users flat file" ansible.builtin.blockinfile: @@ -40,7 +40,7 @@ insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_users.j2') }}" + block: "{{ lookup('template', 'templates/controller_users.j2') }}" vars: current_users_asset_value: "{{ current_user_dir.0 }}" last_user: "{{ current_user_index == ((users_lookvar | length) - 1) }}" @@ -66,21 +66,21 @@ state: directory mode: '0755' vars: - __path: "{{ output_path }}/{{ current_user_dir | regex_replace('/', '_') }}/users" + __path: "{{ output_path }}/{{ current_user_dir | regex_replace('/', '_') }}/controller_users" when: organization_filter is not defined or (current_user_dir is match(organization_filter)) loop: "{{ current_users | selectattr('organizations', 'defined') | map(attribute='organizations') | flatten | unique }}" loop_control: loop_var: current_user_dir label: "{{ __path }}" - - name: "Add current users to the /.yaml output file in {{ output_path }}" + - name: "Add current users to the /controller_.yaml output file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_users.j2" + src: "templates/controller_users.j2" dest: "{{ __dest }}" mode: '0644' vars: current_users_asset_value: "{{ current_user_dir.0 }}" - __dest: "{{ output_path }}/{{ current_user_dir.1 | regex_replace('/', '_') }}/users/{{ current_user_dir.0.username | regex_replace('/', '_') }}.yaml" + __dest: "{{ output_path }}/{{ current_user_dir.1 | regex_replace('/', '_') }}/controller_users/controller_{{ current_user_dir.0.username | regex_replace('/', '_') }}.yaml" when: organization_filter is not defined or (current_user_dir.1 is match(organization_filter)) loop: "{{ current_users | default([]) | subelements('organizations', skip_missing=true) }}" loop_control: @@ -88,7 +88,7 @@ label: "{{ __dest }}" - name: "Set the user's roles" - ansible.builtin.include_tasks: "user_roles.yml" + ansible.builtin.include_tasks: "controller_user_roles.yml" vars: username: "{{ current_user.0.username }}" last_user_role: "{{ current_user_index_for_roles == ((current_users | default([]) | subelements('organizations', skip_missing=true) | length) - 1) }}" diff --git a/roles/filetree_create/tasks/workflow_job_templates.yml b/roles/filetree_create/tasks/controller_workflow_job_templates.yml similarity index 74% rename from roles/filetree_create/tasks/workflow_job_templates.yml rename to roles/filetree_create/tasks/controller_workflow_job_templates.yml index 1580184d..46db38ef 100644 --- a/roles/filetree_create/tasks/workflow_job_templates.yml +++ b/roles/filetree_create/tasks/controller_workflow_job_templates.yml @@ -1,10 +1,10 @@ --- - name: "Get current Workflow Job Templates from the API" ansible.builtin.set_fact: - workflow_job_templates_lookvar: "{{ query(controller_api_plugin, 'api/v2/workflow_job_templates/', + workflow_job_templates_lookvar: "{{ query(controller_api_plugin, 'api/controller/v2/workflow_job_templates/', query_params=(query_params | combine({'organization': organization_id} if organization_id is defined else {}, {'id': workflow_job_template_id} if workflow_job_template_id is defined else {})), - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" vars: @@ -18,13 +18,13 @@ - name: "Get current Job Templates related to workflow from the API" ansible.builtin.set_fact: workflow_node_job_templates_lookvar: "{{ query(controller_api_plugin, workflow_job_templates_lookvar[0]['related']['workflow_nodes'], - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" - name: "Export job templates related to to workflow" - ansible.builtin.include_tasks: "job_templates.yml" + ansible.builtin.include_tasks: "controller_job_templates.yml" vars: job_template_id: "{{ current_workflow_job_node_templates_asset_value['unified_job_template'] }}" loop: "{{ workflow_node_job_templates_lookvar }}" @@ -37,34 +37,34 @@ - flatten_output is defined - flatten_output | bool vars: - __dest: "{{ output_path }}/workflow_job_templates.yaml" + __dest: "{{ output_path }}/controller_workflow_job_templates.yaml" block: - - name: "Add current workflow_job_templates to the workflow_job_templates flat file" + - name: "Add current workflow_job_templates to the controller_workflow_job_templates flat file" ansible.builtin.blockinfile: create: true mode: "0644" insertafter: EOF path: "{{ __dest }}" marker: "" - block: "{{ lookup('template', 'templates/current_workflow_job_templates.j2') }}" + block: "{{ lookup('template', 'templates/controller_workflow_job_templates.j2') }}" vars: workflow_job_template_organization: "{{ current_workflow_job_templates_asset_value.summary_fields.organization.name | default(organization) }}" workflow_job_template_id: "{{ current_workflow_job_templates_asset_value.id }}" workflow_job_template_name: "{{ current_workflow_job_templates_asset_value.name | regex_replace('/', '_') }}" query_labels: "{{ query(controller_api_plugin, current_workflow_job_templates_asset_value.related.labels, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_error: "{{ query(controller_api_plugin, current_workflow_job_templates_asset_value.related.notification_templates_error, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_started: "{{ query(controller_api_plugin, current_workflow_job_templates_asset_value.related.notification_templates_started, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_success: "{{ query(controller_api_plugin, current_workflow_job_templates_asset_value.related.notification_templates_success, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_approvals: "{{ query(controller_api_plugin, current_workflow_job_templates_asset_value.related.notification_templates_approvals, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" last_workflow_job_template: "{{ current_workflow_job_template_index == ((workflow_job_templates_lookvar | length) - 1) }}" loop: "{{ workflow_job_templates_lookvar }}" @@ -83,13 +83,13 @@ - name: "Block for to generate the filetre_create normal output" when: flatten_output is not defined or not (flatten_output | bool) block: - - name: "Create the /workflow_job_templates output directory for workflow job templates in {{ output_path }}" + - name: "Create the /controller_workflow_job_templates output directory for workflow job templates in {{ output_path }}" ansible.builtin.file: path: "{{ __path }}" state: directory mode: '0755' vars: - __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/workflow_job_templates/" + __path: "{{ output_path }}/{{ needed_path | regex_replace('/', '_') }}/controller_workflow_job_templates/" loop: "{{ (workflow_job_templates_lookvar | map(attribute='summary_fields') | selectattr('organization', 'defined') | map(attribute='organization') | map(attribute='name') | list | flatten | unique) + ([organization] if ((workflow_job_templates_lookvar | map(attribute='summary_fields') | @@ -99,30 +99,30 @@ loop_var: needed_path label: "{{ __path }}" - - name: "Add current workflow job templates to the /workflow_job_templates output file in {{ output_path }}" + - name: "Add current workflow job templates to the /controller_workflow_job_templates output file in {{ output_path }}" ansible.builtin.template: - src: "templates/current_workflow_job_templates.j2" + src: "templates/controller_workflow_job_templates.j2" dest: "{{ __dest }}" mode: '0644' vars: workflow_job_template_organization: "{{ current_workflow_job_templates_asset_value.summary_fields.organization.name | default(organization) }}" workflow_job_template_id: "{{ current_workflow_job_templates_asset_value.id }}" workflow_job_template_name: "{{ current_workflow_job_templates_asset_value.name | regex_replace('/', '_') }}" - __dest: "{{ output_path }}/{{ workflow_job_template_organization | regex_replace('/', '_') }}/workflow_job_templates/{{ (workflow_job_template_id ~ '_') if omit_id is not defined else '' }}{{ workflow_job_template_name | regex_replace('/', '_') }}.yaml" + __dest: "{{ output_path }}/{{ workflow_job_template_organization | regex_replace('/', '_') }}/controller_workflow_job_templates/{{ (workflow_job_template_id ~ '_') if omit_id is not defined else '' }}{{ workflow_job_template_name | regex_replace('/', '_') }}.yaml" query_labels: "{{ query(controller_api_plugin, current_workflow_job_templates_asset_value.related.labels, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_error: "{{ query(controller_api_plugin, current_workflow_job_templates_asset_value.related.notification_templates_error, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_started: "{{ query(controller_api_plugin, current_workflow_job_templates_asset_value.related.notification_templates_started, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_success: "{{ query(controller_api_plugin, current_workflow_job_templates_asset_value.related.notification_templates_success, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" query_notification_approvals: "{{ query(controller_api_plugin, current_workflow_job_templates_asset_value.related.notification_templates_approvals, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" loop: "{{ workflow_job_templates_lookvar }}" loop_control: diff --git a/roles/filetree_create/tasks/settings.yml b/roles/filetree_create/tasks/settings.yml deleted file mode 100644 index 856a61c8..00000000 --- a/roles/filetree_create/tasks/settings.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- name: "Get current Settings from the API" - ansible.builtin.set_fact: - changed_settings: "{{ query(controller_api_plugin, 'api/v2/settings/changed/', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, - return_all=true, max_objects=query_controller_api_max_objects) - }}" - no_log: "{{ controller_configuration_filetree_create_secure_logging }}" - -- name: "Create the output directory for credential types: {{ output_path }}" - ansible.builtin.file: - path: "{{ output_path }}" - state: directory - mode: '0755' - -- name: "Add current settings to the settings.yaml output file in {{ output_path }}" - ansible.builtin.template: - src: "templates/current_settings.j2" - dest: "{{ output_path }}/current_settings.yaml" - mode: '0644' -... diff --git a/roles/filetree_create/templates/current_applications.j2 b/roles/filetree_create/templates/controller_applications.j2 similarity index 98% rename from roles/filetree_create/templates/current_applications.j2 rename to roles/filetree_create/templates/controller_applications.j2 index 7e104de3..603fcfa7 100644 --- a/roles/filetree_create/templates/current_applications.j2 +++ b/roles/filetree_create/templates/controller_applications.j2 @@ -1,6 +1,6 @@ {% if (current_application_index | default(0)) == 0 %} --- -controller_applications: +aap_applications: {% endif %} - name: "{{ current_applications_asset_value.name }}" description: "{{ template_overrides_resources.application[current_applications_asset_value.name].description diff --git a/roles/filetree_create/templates/current_credential_types.j2 b/roles/filetree_create/templates/controller_credential_types.j2 similarity index 100% rename from roles/filetree_create/templates/current_credential_types.j2 rename to roles/filetree_create/templates/controller_credential_types.j2 diff --git a/roles/filetree_create/templates/current_credentials.j2 b/roles/filetree_create/templates/controller_credentials.j2 similarity index 96% rename from roles/filetree_create/templates/current_credentials.j2 rename to roles/filetree_create/templates/controller_credentials.j2 index 933e3831..52beff84 100644 --- a/roles/filetree_create/templates/current_credentials.j2 +++ b/roles/filetree_create/templates/controller_credentials.j2 @@ -16,7 +16,7 @@ controller_credentials: or (current_credentials_asset_value.inputs is defined and current_credentials_asset_value.inputs is not match('{}')) %} inputs: {% if show_encrypted is defined and show_encrypted %} -{{ current_credentials_asset_value.inputs | to_nice_yaml(indent=2 | sort_keys=False) | indent(width=6, first=True) }} +{{ current_credentials_asset_value.inputs | to_nice_yaml(indent=2, sort_keys=False) | indent(width=6, first=True) }} {% else %} {{ template_overrides_resources.credential[current_credentials_asset_value.name].inputs | default(current_credentials_asset_value.inputs) diff --git a/roles/filetree_create/templates/current_execution_environments.j2 b/roles/filetree_create/templates/controller_execution_environments.j2 similarity index 100% rename from roles/filetree_create/templates/current_execution_environments.j2 rename to roles/filetree_create/templates/controller_execution_environments.j2 diff --git a/roles/filetree_create/templates/current_groups.j2 b/roles/filetree_create/templates/controller_groups.j2 similarity index 91% rename from roles/filetree_create/templates/current_groups.j2 rename to roles/filetree_create/templates/controller_groups.j2 index 5d9dc964..187c1311 100644 --- a/roles/filetree_create/templates/current_groups.j2 +++ b/roles/filetree_create/templates/controller_groups.j2 @@ -19,7 +19,7 @@ controller_groups: {%- endif %} hosts: {{ query(controller_api_plugin, group.related.hosts, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects ) | selectattr("name", "defined") | map(attribute="name") | to_nice_yaml(indent=2) | indent(width=6, first=True) }} diff --git a/roles/filetree_create/templates/current_hosts.j2 b/roles/filetree_create/templates/controller_hosts.j2 similarity index 100% rename from roles/filetree_create/templates/current_hosts.j2 rename to roles/filetree_create/templates/controller_hosts.j2 diff --git a/roles/filetree_create/templates/current_instance_groups.j2 b/roles/filetree_create/templates/controller_instance_groups.j2 similarity index 80% rename from roles/filetree_create/templates/current_instance_groups.j2 rename to roles/filetree_create/templates/controller_instance_groups.j2 index eb0bcabb..a3551a89 100644 --- a/roles/filetree_create/templates/current_instance_groups.j2 +++ b/roles/filetree_create/templates/controller_instance_groups.j2 @@ -6,7 +6,7 @@ controller_instance_groups: policy_instance_percentage: "{{ ig.policy_instance_percentage }}" instances: {% for instance in query(controller_api_plugin, ig.related.instances, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) %} - "{{ instance.hostname }}" {% endfor %} diff --git a/roles/filetree_create/templates/current_inventories.j2 b/roles/filetree_create/templates/controller_inventories.j2 similarity index 100% rename from roles/filetree_create/templates/current_inventories.j2 rename to roles/filetree_create/templates/controller_inventories.j2 diff --git a/roles/filetree_create/templates/current_inventory_sources.j2 b/roles/filetree_create/templates/controller_inventory_sources.j2 similarity index 93% rename from roles/filetree_create/templates/current_inventory_sources.j2 rename to roles/filetree_create/templates/controller_inventory_sources.j2 index a7750615..c16472ff 100644 --- a/roles/filetree_create/templates/current_inventory_sources.j2 +++ b/roles/filetree_create/templates/controller_inventory_sources.j2 @@ -52,13 +52,13 @@ controller_inventory_sources: | default(inventory_source.summary_fields.credential.name) }}" {% endif %} {% set query_notification_error = query(controller_api_plugin, inventory_source.related.notification_templates_error, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) %} {% set query_notification_started = query(controller_api_plugin, inventory_source.related.notification_templates_started, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) %} {% set query_notification_success = query(controller_api_plugin, inventory_source.related.notification_templates_success, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) %} {% if query_notification_error | length > 0 %} notification_templates_error: diff --git a/roles/filetree_create/templates/current_job_templates.j2 b/roles/filetree_create/templates/controller_job_templates.j2 similarity index 99% rename from roles/filetree_create/templates/current_job_templates.j2 rename to roles/filetree_create/templates/controller_job_templates.j2 index 47d66d0c..d621e290 100644 --- a/roles/filetree_create/templates/current_job_templates.j2 +++ b/roles/filetree_create/templates/controller_job_templates.j2 @@ -193,7 +193,7 @@ controller_templates: {% set survey_spec_contents = template_overrides_resources.job_template[current_job_templates_asset_value.name].survey_spec | default(template_overrides_global.job_template.survey_spec) | default(query(controller_api_plugin, current_job_templates_asset_value.related.survey_spec, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs)[0]) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs)[0]) | from_yaml | to_nice_yaml(indent=2,width=500,sort_keys=False) | regex_replace("\n\n[ ]*", "\\\\n") | indent(width=6, first=False) | replace("'{{", "!unsafe \'{{") | replace("^$", "") | replace("$encrypted$", "\'\'") | replace("'", '"') | regex_replace('default: ([^"].*)', 'default: "\\g<1>"') diff --git a/roles/filetree_create/templates/current_labels.j2 b/roles/filetree_create/templates/controller_labels.j2 similarity index 100% rename from roles/filetree_create/templates/current_labels.j2 rename to roles/filetree_create/templates/controller_labels.j2 diff --git a/roles/filetree_create/templates/current_notification_templates.j2 b/roles/filetree_create/templates/controller_notification_templates.j2 similarity index 100% rename from roles/filetree_create/templates/current_notification_templates.j2 rename to roles/filetree_create/templates/controller_notification_templates.j2 diff --git a/roles/filetree_create/templates/current_organizations.j2 b/roles/filetree_create/templates/controller_organizations.j2 similarity index 98% rename from roles/filetree_create/templates/current_organizations.j2 rename to roles/filetree_create/templates/controller_organizations.j2 index 3b69b0a5..226caa78 100644 --- a/roles/filetree_create/templates/current_organizations.j2 +++ b/roles/filetree_create/templates/controller_organizations.j2 @@ -1,6 +1,6 @@ {% if (current_organization_index | default(0)) == 0 %} --- -controller_organizations: +aap_organizations: {% endif %} - name: "{{ current_organization.name }}" description: "{{ template_overrides_resources.organization[current_organization.name].description diff --git a/roles/filetree_create/templates/current_projects.j2 b/roles/filetree_create/templates/controller_projects.j2 similarity index 100% rename from roles/filetree_create/templates/current_projects.j2 rename to roles/filetree_create/templates/controller_projects.j2 diff --git a/roles/filetree_create/templates/current_schedules.j2 b/roles/filetree_create/templates/controller_schedules.j2 similarity index 100% rename from roles/filetree_create/templates/current_schedules.j2 rename to roles/filetree_create/templates/controller_schedules.j2 diff --git a/roles/filetree_create/templates/current_settings.j2 b/roles/filetree_create/templates/controller_settings.j2 similarity index 100% rename from roles/filetree_create/templates/current_settings.j2 rename to roles/filetree_create/templates/controller_settings.j2 diff --git a/roles/filetree_create/templates/current_team_access_list.j2 b/roles/filetree_create/templates/controller_team_access_list.j2 similarity index 100% rename from roles/filetree_create/templates/current_team_access_list.j2 rename to roles/filetree_create/templates/controller_team_access_list.j2 diff --git a/roles/filetree_create/templates/current_team_roles.j2 b/roles/filetree_create/templates/controller_team_roles.j2 similarity index 100% rename from roles/filetree_create/templates/current_team_roles.j2 rename to roles/filetree_create/templates/controller_team_roles.j2 diff --git a/roles/filetree_create/templates/current_teams.j2 b/roles/filetree_create/templates/controller_teams.j2 similarity index 96% rename from roles/filetree_create/templates/current_teams.j2 rename to roles/filetree_create/templates/controller_teams.j2 index 29c47e95..85ba5e2c 100644 --- a/roles/filetree_create/templates/current_teams.j2 +++ b/roles/filetree_create/templates/controller_teams.j2 @@ -1,6 +1,6 @@ {% if (current_team_index | default(0)) == 0 %} --- -controller_teams: +aap_teams: {% endif %} - name: "{{ current_teams_asset_value.name }}" description: "{{ template_overrides_resources.team[current_teams_asset_value.name].description diff --git a/roles/filetree_create/templates/current_user_access_list.j2 b/roles/filetree_create/templates/controller_user_access_list.j2 similarity index 100% rename from roles/filetree_create/templates/current_user_access_list.j2 rename to roles/filetree_create/templates/controller_user_access_list.j2 diff --git a/roles/filetree_create/templates/current_user_roles.j2 b/roles/filetree_create/templates/controller_user_roles.j2 similarity index 100% rename from roles/filetree_create/templates/current_user_roles.j2 rename to roles/filetree_create/templates/controller_user_roles.j2 diff --git a/roles/filetree_create/templates/current_users.j2 b/roles/filetree_create/templates/controller_users.j2 similarity index 98% rename from roles/filetree_create/templates/current_users.j2 rename to roles/filetree_create/templates/controller_users.j2 index 3166cbd2..5a5f1d09 100644 --- a/roles/filetree_create/templates/current_users.j2 +++ b/roles/filetree_create/templates/controller_users.j2 @@ -1,6 +1,6 @@ {% if (current_user_index | default(0)) == 0 %} --- -controller_user_accounts: +aap_user_accounts: {% endif %} - username: "{{ current_users_asset_value.username }}" password: "INITIAL" diff --git a/roles/filetree_create/templates/current_workflow_job_templates.j2 b/roles/filetree_create/templates/controller_workflow_job_templates.j2 similarity index 90% rename from roles/filetree_create/templates/current_workflow_job_templates.j2 rename to roles/filetree_create/templates/controller_workflow_job_templates.j2 index 9192e755..51119573 100644 --- a/roles/filetree_create/templates/current_workflow_job_templates.j2 +++ b/roles/filetree_create/templates/controller_workflow_job_templates.j2 @@ -11,9 +11,9 @@ controller_workflows: | default(template_overrides_global.workflow_template.state) | default('present') }}" simplified_workflow_nodes: -{% for node in query(controller_api_plugin, 'api/v2/workflow_job_template_nodes/', +{% for node in query(controller_api_plugin, 'api/controller/v2/workflow_job_template_nodes/', query_params={'workflow_job_template': current_workflow_job_templates_asset_value.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) %} - identifier: "{{ node.identifier }}" workflow_job_template: "{{ node.summary_fields.workflow_job_template.name }}" @@ -30,19 +30,19 @@ controller_workflows: {% if node.success_nodes is defined and node.success_nodes | length > 0 %} success_nodes: {% for success in node.success_nodes %} - - {{ query(controller_api_plugin, 'workflow_job_template_nodes/'+(success | string), host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs)[0].identifier }} + - {{ query(controller_api_plugin, 'workflow_job_template_nodes/'+(success | string), host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs)[0].identifier }} {% endfor %} {% endif %} {% if node.always_nodes and node.always_nodes | length > 0 %} always_nodes: {% for always in node.always_nodes %} - - {{ query(controller_api_plugin, 'workflow_job_template_nodes/'+(always | string), host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs)[0].identifier }} + - {{ query(controller_api_plugin, 'workflow_job_template_nodes/'+(always | string), host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs)[0].identifier }} {% endfor %} {% endif %} {% if node.failure_nodes and node.failure_nodes | length > 0 %} failure_nodes: {% for failure in node.failure_nodes %} - - {{ query(controller_api_plugin, 'workflow_job_template_nodes/'+(failure | string), host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs)[0].identifier }} + - {{ query(controller_api_plugin, 'workflow_job_template_nodes/'+(failure | string), host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs)[0].identifier }} {% endfor %} {% endif %} {% endfor %} @@ -103,7 +103,7 @@ controller_workflows: {% set survey_spec_contents = template_overrides_resources.workflow_job_template[current_workflow_job_templates_asset_value.name].survey_spec | default(template_overrides_global.workflow_job_template.survey_spec) | default(query(controller_api_plugin, current_workflow_job_templates_asset_value.related.survey_spec, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs)[0]) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs)[0]) | from_yaml | to_nice_yaml(indent=2,width=500, sort_keys=False) | regex_replace("\n\n[ ]*", "\\\\n") | indent(width=6, first=False) | replace("'{{", "!unsafe \'{{") | replace("^$", "") | replace("$encrypted$", "\'\'") | replace("'", '"') | regex_replace('default: ([^"].*)', 'default: "\\g<1>"') diff --git a/roles/filetree_create/tests/filetree_create.yml b/roles/filetree_create/tests/filetree_create.yml index 41b0b62f..de0b206a 100644 --- a/roles/filetree_create/tests/filetree_create.yml +++ b/roles/filetree_create/tests/filetree_create.yml @@ -4,23 +4,23 @@ connection: local gather_facts: false vars: - controller_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" - controller_password: "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" - controller_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" + aap_username: "{{ vault_aap_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" + aap_password: "{{ vault_aap_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" + aap_hostname: "{{ vault_aap_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" controller_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}" pre_tasks: - name: "Setup authentication (block)" no_log: "{{ controller_configuration_filetree_create_secure_logging }}" - when: controller_oauthtoken is not defined + when: aap_oauthtoken is not defined tags: - always block: - name: "Get the Authentication Token for the future requests" ansible.builtin.uri: - url: "https://{{ controller_hostname }}/api/v2/tokens/" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}/api/gateway/v1/tokens/" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: POST force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" @@ -29,8 +29,8 @@ - name: "Set the oauth token to be used since now" ansible.builtin.set_fact: - controller_oauthtoken: "{{ authtoken_res.json.token }}" - controller_oauthtoken_url: "{{ authtoken_res.json.url }}" + aap_oauthtoken: "{{ authtoken_res.json.token }}" + aap_oauthtoken_url: "{{ authtoken_res.json.url }}" roles: - infra.aap_configuration_extended.filetree_create @@ -38,13 +38,13 @@ post_tasks: - name: "Delete the Authentication Token used" ansible.builtin.uri: - url: "https://{{ controller_hostname }}{{ controller_oauthtoken_url }}" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}{{ aap_oauthtoken_url }}" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: DELETE force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" status_code: 204 - when: controller_oauthtoken_url is defined + when: aap_oauthtoken_url is defined ... -# ansible-playbook -i localhost, filetree_create.yml -e '{controller_configuration_inventories_enforce_defaults: false, controller_configuration_inventory_sources_enforce_defaults: false, controller_validate_certs: false, controller_hostname: localhost:8443, controller_username: , controller_password: , flatten_output: true}' +# ansible-playbook -i localhost, filetree_create.yml -e '{controller_configuration_inventories_enforce_defaults: false, controller_configuration_inventory_sources_enforce_defaults: false, controller_validate_certs: false, aap_hostname: localhost:8443, aap_username: , aap_password: , flatten_output: true}' diff --git a/roles/filetree_read/README.md b/roles/filetree_read/README.md index c2bc716d..0fe35302 100644 --- a/roles/filetree_read/README.md +++ b/roles/filetree_read/README.md @@ -19,17 +19,17 @@ The following Variables set the organization where should be applied the configu |`env:`|String|dev|no|This variable sets the life-cycle environment to use.| |`controller_location`|String|''|no|This variable sets object localtion. It is useful when the configuration need to be replicated in an active/passive sites architecture| |`filetree_controller_settings`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_settings.d/|no|Directory path to load controller object variables| -|`filetree_controller_organizations`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_organizations.d/|no|Directory path to load controller object variables| +|`filetree_aap_organizations`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/common/aap_organizations.d/|no|Directory path to load controller object variables| |`filetree_controller_labels`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_labels.d/|no|Directory path to load controller object variables| -|`filetree_controller_user_accounts`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_users.d/|no|Directory path to load controller object variables| -|`filetree_controller_teams`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_teams.d/|no|Directory path to load controller object variables| +|`filetree_aap_user_accounts`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_users.d/|no|Directory path to load controller object variables| +|`filetree_aap_teams`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/common/aap_teams.d/|no|Directory path to load controller object variables| |`filetree_controller_credential_types`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_credential_types.d/|no|Directory path to load controller object variables| |`filetree_controller_credentials`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_credentials.d/|no|Directory path to load controller object variables| |`filetree_controller_credential_input_sources`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_credential_input_sources.d/|no|Directory path to load controller object variables| |`filetree_controller_notifications`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_notification_templates.d/|no|Directory path to load controller object variables| |`filetree_controller_projects`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_projects.d/|no|Directory path to load controller object variables| |`filetree_controller_execution_environments`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_execution_environments.d/|no|Directory path to load controller object variables| -|`filetree_controller_applications`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_applications.d/|no|Directory path to load controller object variables| +|`filetree_aap_applications`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/common/aap_applications.d/|no|Directory path to load controller object variables| |`filetree_controller_inventories`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_inventories.d/|no|Directory path to load controller object variables| |`filetree_controller_inventory_sources`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_inventory_sources.d/|no|Directory path to load controller object variables| |`filetree_controller_instance_groups`|String/List(String)|{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_instance_groups.d/|no|Directory path to load controller object variables| @@ -81,9 +81,9 @@ orgs_vars/env/ $ $ ansible-vault view orgs_vars/env/demo-dev/configure_connection_controller_credentials.yml Vault password: --- -vault_controller_username: 'ldap-admin-org1' -vault_controller_password: 'password' -vault_controller_hostname: controller-dev.lab.example.com +vault_aap_username: 'ldap-admin-org1' +vault_aap_password: 'password' +vault_aap_hostname: controller-dev.lab.example.com vault_controller_validate_certs: false ... @@ -123,14 +123,14 @@ orgs_vars/Organization1 │   │   │   ├── controller_job_templates_crossteams.yml │   │   │   └── controller_job_templates_demo_push.yml │   │   └── controller_job_templates.yml - │   ├── controller_organizations.d + │   ├── aap_organizations.d │   │   ├── app-casc - │   │   │   └── controller_organizations_Global.yml + │   │   │   └── aap_organizations_Global.yml │   │   ├── app-example - │   │   │   ├── controller_organizations_ExampleOrg.yml - │   │   │   ├── controller_organizations_Organizations1-2.yml - │   │   │   └── controller_organizations_OrgCrossTeams.yml - │   │   └── controller_organizations.yml + │   │   │   ├── aap_organizations_ExampleOrg.yml + │   │   │   ├── aap_organizations_Organizations1-2.yml + │   │   │   └── aap_organizations_OrgCrossTeams.yml + │   │   └── aap_organizations.yml │   ├── controller_projects.d │   │   ├── app-casc │   │   │   └── controller_projects_casc.yml @@ -156,11 +156,11 @@ orgs_vars/Organization1 │   │   ├── app-example │   │   │   └── controller_schedules_example.yml │   │   └── controller_schedules.yml - │   ├── controller_teams.d + │   ├── aap_teams.d │   │   ├── app-demo - │   │   │   ├── controller_teams_org1.yml - │   │   │   └── controller_teams_org2.yml - │   │   └── controller_teams.yml + │   │   │   ├── aap_teams_org1.yml + │   │   │   └── aap_teams_org2.yml + │   │   └── aap_teams.yml │   └── controller_workflow_job_templates.d │   ├── app-casc │   │   └── controller_workflow_job_templates_casc.yml @@ -200,9 +200,9 @@ orgs_vars/Organization1 │   │   └── controller_instance_groups.yml │   ├── controller_users.d │   │   ├── app-demo - │   │   │   ├── controller_user_accounts_org1.yml - │   │   │   └── controller_user_accounts_org2.yml - │   │   └── controller_user_accounts.yml + │   │   │   ├── aap_user_accounts_org1.yml + │   │   │   └── aap_user_accounts_org2.yml + │   │   └── aap_user_accounts.yml │   ├── controller_inventory_sources.d │   │   ├── app-examples │   │   │   ├── controller_inventory_sources_sourcea_dev.yml @@ -248,9 +248,9 @@ orgs_vars/Organization1 │   └── controller_instance_groups.yml    ├── controller_users.d    │   ├── app-demo -    │   │   ├── controller_user_accounts_org1.yml -     │   │   └── controller_user_accounts_org2.yml -    │   └── controller_user_accounts.yml +    │   │   ├── aap_user_accounts_org1.yml +     │   │   └── aap_user_accounts_org2.yml +    │   └── aap_user_accounts.yml ├── controller_inventory_sources.d │   ├── app-examples │   │   ├── controller_inventory_sources_sourcea_dev.yml @@ -291,9 +291,9 @@ The role is designed to be used with tags, each tags correspond to an AWX or Aut vars: controller_configuration_projects_async_retries: 60 controller_configuration_projects_async_delay: 2 - controller_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" - controller_password: "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" - controller_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" + aap_username: "{{ vault_aap_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" + aap_password: "{{ vault_aap_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" + aap_hostname: "{{ vault_aap_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" controller_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}" pre_tasks: @@ -301,9 +301,9 @@ The role is designed to be used with tags, each tags correspond to an AWX or Aut block: - name: "Get the Authentication Token for the future requests" ansible.builtin.uri: - url: "https://{{ controller_hostname }}/api/v2/tokens/" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}/api/gateway/v1/tokens/" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: POST force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" @@ -312,10 +312,10 @@ The role is designed to be used with tags, each tags correspond to an AWX or Aut - name: "Set the oauth token to be used since now" ansible.builtin.set_fact: - controller_oauthtoken: "{{ authtoken_res.json.token }}" - controller_oauthtoken_url: "{{ authtoken_res.json.url }}" + aap_oauthtoken: "{{ authtoken_res.json.token }}" + aap_oauthtoken_url: "{{ authtoken_res.json.url }}" no_log: true - when: controller_oauthtoken is not defined + when: aap_oauthtoken is not defined tags: - always @@ -340,7 +340,7 @@ The role is designed to be used with tags, each tags correspond to an AWX or Aut vars: assign_galaxy_credentials_to_org: false controller_configuration_dispatcher_roles: - - {role: organizations, var: controller_organizations, tags: organizations} + - {role: organizations, var: aap_organizations, tags: organizations} - {role: credentials, var: controller_credentials, tags: credentials} roles: @@ -350,14 +350,14 @@ The role is designed to be used with tags, each tags correspond to an AWX or Aut post_tasks: - name: "Delete the Authentication Token used" ansible.builtin.uri: - url: "https://{{ controller_hostname }}{{ controller_oauthtoken_url }}" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}{{ aap_oauthtoken_url }}" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: DELETE force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" status_code: 204 - when: controller_oauthtoken_url is defined + when: aap_oauthtoken_url is defined ... ``` diff --git a/roles/filetree_read/defaults/main.yml b/roles/filetree_read/defaults/main.yml index 1a3936c7..f0b29fbf 100644 --- a/roles/filetree_read/defaults/main.yml +++ b/roles/filetree_read/defaults/main.yml @@ -8,17 +8,17 @@ controller_configuration_filetree_read_secure_logging: "{{ controller_configurat # Controller lists controller_settings: [] -controller_organizations: [] +aap_organizations: [] controller_labels: [] -controller_user_accounts: [] -controller_teams: [] +aap_user_accounts: [] +aap_teams: [] controller_credential_types: [] controller_credentials: [] controller_credential_input_sources: [] controller_notifications: [] controller_projects: [] controller_execution_environments: [] -controller_applications: [] +aap_applications: [] controller_inventories: [] controller_inventory_sources: [] controller_instance_groups: [] @@ -31,17 +31,17 @@ controller_roles: [] # Controller Directory Path filetree_controller_settings: "{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_settings.d/" -filetree_controller_organizations: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_organizations.d/" +filetree_aap_organizations: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/aap_organizations.d/" filetree_controller_labels: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_labels.d/" -filetree_controller_user_accounts: "{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_users.d/" -filetree_controller_teams: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_teams.d/" +filetree_aap_user_accounts: "{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_users.d/" +filetree_aap_teams: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/aap_teams.d/" filetree_controller_credential_types: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_credential_types.d/" filetree_controller_credentials: "{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_credentials.d/" filetree_controller_credential_input_sources: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_credential_input_sources.d/" filetree_controller_notifications: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_notification_templates.d/" filetree_controller_projects: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_projects.d/" filetree_controller_execution_environments: "{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_execution_environments.d/" -filetree_controller_applications: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_applications.d/" +filetree_aap_applications: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/aap_applications.d/" filetree_controller_inventories: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_inventories.d/" filetree_controller_inventory_sources: "{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_inventory_sources.d/" filetree_controller_instance_groups: "{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_instance_groups.d/" @@ -55,17 +55,17 @@ filetree_controller_roles: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller # filetree_read tasks order and name controller_configuration_filetree_read_tasks: - {name: settings, var: controller_settings, tags: settings} - - {name: organizations, var: controller_organizations, tags: organizations} + - {name: organizations, var: aap_organizations, tags: organizations} - {name: labels, var: controller_labels, tags: labels} - - {name: user_accounts, var: controller_user_accounts, tags: users} - - {name: teams, var: controller_teams, tags: teams} + - {name: user_accounts, var: aap_user_accounts, tags: users} + - {name: teams, var: aap_teams, tags: teams} - {name: credential_types, var: controller_credential_types, tags: credential_types} - {name: credential_input_sources, var: controller_credential_input_sources, tags: credential_input_sources} - {name: credentials, var: controller_credentials, tags: credentials} - {name: notifications, var: controller_notifications, tags: notification_templates} - {name: projects, var: controller_projects, tags: projects} - {name: execution_environments, var: controller_execution_environments, tags: execution_environments} - - {name: applications, var: controller_applications, tags: applications} + - {name: applications, var: aap_applications, tags: applications} - {name: inventories, var: controller_inventories, tags: inventories} - {name: inventory_sources, var: controller_inventory_sources, tags: inventory_sources} - {name: instance_groups, var: controller_instance_groups, tags: instance_groups} diff --git a/roles/filetree_read/meta/argument_specs.yml b/roles/filetree_read/meta/argument_specs.yml index 2183ee8f..8c7081f1 100644 --- a/roles/filetree_read/meta/argument_specs.yml +++ b/roles/filetree_read/meta/argument_specs.yml @@ -26,9 +26,9 @@ argument_specs: default: "{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_settings.d/" required: false description: Directory path to load controller object variables - filetree_controller_organizations: + filetree_aap_organizations: type: raw - default: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_organizations.d/" + default: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/aap_organizations.d/" required: false description: Directory path to load controller object variables filetree_controller_labels: @@ -36,14 +36,14 @@ argument_specs: default: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_labels.d/" required: false description: Directory path to load controller object variables - filetree_controller_user_accounts: + filetree_aap_user_accounts: type: raw default: "{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_users.d/" required: false description: Directory path to load controller object variables - filetree_controller_teams: + filetree_aap_teams: type: raw - default: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_teams.d/" + default: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/aap_teams.d/" required: false description: Directory path to load controller object variables filetree_controller_credential_types: @@ -76,9 +76,9 @@ argument_specs: default: "{{ dir_orgs_vars }}/{{ orgs }}/env/{{ env }}/controller_execution_environments.d/" required: false description: Directory path to load controller object variables - filetree_controller_applications: + filetree_aap_applications: type: raw - default: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/controller_applications.d/" + default: "{{ dir_orgs_vars }}/{{ orgs }}/env/common/aap_applications.d/" required: false description: Directory path to load controller object variables filetree_controller_inventories: @@ -170,7 +170,7 @@ argument_specs: required: false description: The state all objects will take unless overridden by object default type: str - controller_hostname: + aap_hostname: default: None required: false description: URL to the Ansible Controller Server. @@ -180,17 +180,17 @@ argument_specs: required: false description: Whether or not to validate the Ansible Controller Server's SSL certificate. type: str - controller_username: + aap_username: default: None required: false description: Admin User on the Ansible Controller Server. Either username / password or oauthtoken need to be specified. type: str - controller_password: + aap_password: default: None required: false description: Controller Admin User's password on the Ansible Controller Server. This should be stored in an Ansible Vault at vars/controller-secrets.yml or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified. type: str - controller_oauthtoken: + aap_oauthtoken: default: None required: false description: Controller Admin User's token on the Ansible Controller Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified. diff --git a/roles/filetree_read/tasks/applications.yml b/roles/filetree_read/tasks/applications.yml index 9f7bf3cb..cc947940 100644 --- a/roles/filetree_read/tasks/applications.yml +++ b/roles/filetree_read/tasks/applications.yml @@ -1,35 +1,35 @@ --- -- name: "Get list of files inside {{ filetree_controller_applications }}" +- name: "Get list of files inside {{ filetree_aap_applications }}" ansible.builtin.find: - paths: "{{ filetree_controller_applications }}" + paths: "{{ filetree_aap_applications }}" file_type: file patterns: "{{ filetree_controller_include | default(omit) }}" excludes: "{{ filetree_controller_exclude | default(omit) }}" use_regex: "{{ filetree_controller_regex | default(false) }}" recurse: true - register: __list_files_controller_applications + register: __list_files_aap_applications - name: "Read Applications definitions" ansible.builtin.include_vars: file: "{{ __read_applications_definitions_item.path }}" - loop: "{{ __list_files_controller_applications.files }}" + loop: "{{ __list_files_aap_applications.files }}" loop_control: loop_var: __read_applications_definitions_item - register: __contents_filetree_controller_applications - failed_when: "'VARIABLE IS NOT DEFINED' in __contents_filetree_controller_applications" + register: __contents_filetree_aap_applications + failed_when: "'VARIABLE IS NOT DEFINED' in __contents_filetree_aap_applications" - name: "Populate Applications list" ansible.builtin.set_fact: - __populate_controller_applications: "{{ (__populate_controller_applications | default([])) + __populate_applications_list_item.ansible_facts.controller_applications }}" - loop: "{{ __contents_filetree_controller_applications.results }}" + __populate_aap_applications: "{{ (__populate_aap_applications | default([])) + __populate_applications_list_item.ansible_facts.aap_applications }}" + loop: "{{ __contents_filetree_aap_applications.results }}" loop_control: loop_var: __populate_applications_list_item no_log: "{{ controller_configuration_filetree_read_secure_logging }}" - when: __contents_filetree_controller_applications.results is defined and __populate_applications_list_item.ansible_facts.controller_applications is defined + when: __contents_filetree_aap_applications.results is defined and __populate_applications_list_item.ansible_facts.aap_applications is defined - name: "Set Applications Data Structure" ansible.builtin.set_fact: - controller_applications: "{{ __populate_controller_applications }}" + aap_applications: "{{ __populate_aap_applications }}" no_log: "{{ controller_configuration_filetree_read_secure_logging }}" - when: __populate_controller_applications is defined + when: __populate_aap_applications is defined ... diff --git a/roles/filetree_read/tasks/main.yml b/roles/filetree_read/tasks/main.yml index d6978865..b06f5050 100644 --- a/roles/filetree_read/tasks/main.yml +++ b/roles/filetree_read/tasks/main.yml @@ -3,17 +3,17 @@ - name: "Init controller variables" ansible.builtin.set_fact: controller_settings: [] - controller_organizations: [] + aap_organizations: [] controller_labels: [] - controller_user_accounts: [] - controller_teams: [] + aap_user_accounts: [] + aap_teams: [] controller_credential_types: [] controller_credentials: [] controller_credential_input_sources: [] controller_notifications: [] controller_projects: [] controller_execution_environments: [] - controller_applications: [] + aap_applications: [] controller_inventories: [] controller_inventory_sources: [] controller_instance_groups: [] diff --git a/roles/filetree_read/tasks/organizations.yml b/roles/filetree_read/tasks/organizations.yml index a3d21695..b8dff867 100644 --- a/roles/filetree_read/tasks/organizations.yml +++ b/roles/filetree_read/tasks/organizations.yml @@ -1,35 +1,35 @@ --- -- name: "Get list of files inside {{ filetree_controller_organizations }}" +- name: "Get list of files inside {{ filetree_aap_organizations }}" ansible.builtin.find: - paths: "{{ filetree_controller_organizations }}" + paths: "{{ filetree_aap_organizations }}" file_type: file patterns: "{{ filetree_controller_include | default(omit) }}" excludes: "{{ filetree_controller_exclude | default(omit) }}" use_regex: "{{ filetree_controller_regex | default(false) }}" recurse: true - register: __list_files_controller_organizations + register: __list_files_aap_organizations - name: "Read Organization definitions" ansible.builtin.include_vars: file: "{{ __read_organizations_definitions_item.path }}" - loop: "{{ __list_files_controller_organizations.files }}" + loop: "{{ __list_files_aap_organizations.files }}" loop_control: loop_var: __read_organizations_definitions_item - register: __contents_filetree_controller_organizations - failed_when: "'VARIABLE IS NOT DEFINED' in __contents_filetree_controller_organizations" + register: __contents_filetree_aap_organizations + failed_when: "'VARIABLE IS NOT DEFINED' in __contents_filetree_aap_organizations" - name: "Populate Organizations list" ansible.builtin.set_fact: - __populate_controller_organizations: "{{ (__populate_controller_organizations | default([])) + __populate_organizations_list_item.ansible_facts.controller_organizations }}" - loop: "{{ __contents_filetree_controller_organizations.results }}" + __populate_aap_organizations: "{{ (__populate_aap_organizations | default([])) + __populate_organizations_list_item.ansible_facts.aap_organizations }}" + loop: "{{ __contents_filetree_aap_organizations.results }}" loop_control: loop_var: __populate_organizations_list_item no_log: "{{ controller_configuration_filetree_read_secure_logging }}" - when: __contents_filetree_controller_organizations.results is defined and __populate_organizations_list_item.ansible_facts.controller_organizations is defined + when: __contents_filetree_aap_organizations.results is defined and __populate_organizations_list_item.ansible_facts.aap_organizations is defined - name: "Set Organization Data Structure" ansible.builtin.set_fact: - controller_organizations: "{{ __populate_controller_organizations }}" + aap_organizations: "{{ __populate_aap_organizations }}" no_log: "{{ controller_configuration_filetree_read_secure_logging }}" - when: __populate_controller_organizations is defined + when: __populate_aap_organizations is defined ... diff --git a/roles/filetree_read/tasks/teams.yml b/roles/filetree_read/tasks/teams.yml index 83af5866..a9e2620e 100644 --- a/roles/filetree_read/tasks/teams.yml +++ b/roles/filetree_read/tasks/teams.yml @@ -1,32 +1,32 @@ --- -- name: "Get list of files inside {{ filetree_controller_teams }}" +- name: "Get list of files inside {{ filetree_aap_teams }}" ansible.builtin.find: - paths: "{{ filetree_controller_teams }}" + paths: "{{ filetree_aap_teams }}" file_type: file patterns: "{{ filetree_controller_include | default(omit) }}" excludes: "{{ filetree_controller_exclude | default(omit) }}" use_regex: "{{ filetree_controller_regex | default(false) }}" recurse: true - register: __list_files_controller_teams + register: __list_files_aap_teams - name: "Read Teams definitions" ansible.builtin.include_vars: file: "{{ __read_teams_definitions_item.path }}" - loop: "{{ __list_files_controller_teams.files }}" + loop: "{{ __list_files_aap_teams.files }}" loop_control: loop_var: __read_teams_definitions_item - register: __contents_filetree_controller_teams - failed_when: "'VARIABLE IS NOT DEFINED' in __contents_filetree_controller_teams" + register: __contents_filetree_aap_teams + failed_when: "'VARIABLE IS NOT DEFINED' in __contents_filetree_aap_teams" - name: "Set Roles Data Structure" ansible.builtin.set_fact: controller_roles: >- {{ - __contents_filetree_controller_teams.results | - rejectattr('ansible_facts.controller_teams', 'undefined') | - map(attribute='ansible_facts.controller_teams') | + __contents_filetree_aap_teams.results | + rejectattr('ansible_facts.aap_teams', 'undefined') | + map(attribute='ansible_facts.aap_teams') | ansible.builtin.flatten }} no_log: "{{ controller_configuration_filetree_read_secure_logging }}" - when: __contents_filetree_controller_teams.results + when: __contents_filetree_aap_teams.results ... diff --git a/roles/filetree_read/tasks/user_accounts.yml b/roles/filetree_read/tasks/user_accounts.yml index 047804e8..1005ec24 100644 --- a/roles/filetree_read/tasks/user_accounts.yml +++ b/roles/filetree_read/tasks/user_accounts.yml @@ -1,34 +1,34 @@ --- -- name: "Get list of files inside {{ filetree_controller_user_accounts }}" +- name: "Get list of files inside {{ filetree_aap_user_accounts }}" ansible.builtin.find: - paths: "{{ filetree_controller_user_accounts }}" + paths: "{{ filetree_aap_user_accounts }}" file_type: file patterns: "{{ filetree_controller_include | default(omit) }}" excludes: "{{ filetree_controller_exclude | default(omit) }}" use_regex: "{{ filetree_controller_regex | default(false) }}" recurse: true - register: __list_files_controller_user_accounts + register: __list_files_aap_user_accounts - name: "Read User Accounts definitions" ansible.builtin.include_vars: file: "{{ __read_user_accounts_definitions_item.path }}" - loop: "{{ __list_files_controller_user_accounts.files }}" + loop: "{{ __list_files_aap_user_accounts.files }}" loop_control: loop_var: __read_user_accounts_definitions_item - register: __contents_filetree_controller_user_accounts - failed_when: "'VARIABLE IS NOT DEFINED' in __contents_filetree_controller_user_accounts" + register: __contents_filetree_aap_user_accounts + failed_when: "'VARIABLE IS NOT DEFINED' in __contents_filetree_aap_user_accounts" - name: "Populate User Accounts list" ansible.builtin.set_fact: - __populate_controller_user_accounts: "{{ (__populate_controller_user_accounts | default([])) + __populate_user_accounts_list_item.ansible_facts.controller_user_accounts }}" - loop: "{{ __contents_filetree_controller_user_accounts.results }}" + __populate_aap_user_accounts: "{{ (__populate_aap_user_accounts | default([])) + __populate_user_accounts_list_item.ansible_facts.aap_user_accounts }}" + loop: "{{ __contents_filetree_aap_user_accounts.results }}" loop_control: loop_var: __populate_user_accounts_list_item no_log: "{{ controller_configuration_filetree_read_secure_logging }}" - when: __contents_filetree_controller_user_accounts.results is defined and __populate_user_accounts_list_item.ansible_facts.controller_user_accounts is defined + when: __contents_filetree_aap_user_accounts.results is defined and __populate_user_accounts_list_item.ansible_facts.aap_user_accounts is defined - name: "Set User Accounts Data Structure" ansible.builtin.set_fact: - controller_user_accounts: "{{ __populate_controller_user_accounts }}" - when: __populate_controller_user_accounts is defined + aap_user_accounts: "{{ __populate_aap_user_accounts }}" + when: __populate_aap_user_accounts is defined ... diff --git a/roles/filetree_read/tests/config-controller-filetree.yml b/roles/filetree_read/tests/config-controller-filetree.yml index eb8a0ef9..00b31272 100644 --- a/roles/filetree_read/tests/config-controller-filetree.yml +++ b/roles/filetree_read/tests/config-controller-filetree.yml @@ -6,20 +6,20 @@ vars: aap_configuration_projects_async_retries: 120 aap_configuration_projects_async_delay: 2 - aap_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" - aap_password: "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" - aap_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" + aap_username: "{{ vault_aap_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" + aap_password: "{{ vault_aap_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" + aap_hostname: "{{ vault_aap_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" aap_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}" pre_tasks: - name: "Setup authentication (block)" no_log: "{{ controller_configuration_filetree_read_secure_logging | default('false') }}" - when: controller_oauthtoken is not defined + when: aap_oauthtoken is not defined tags: - always block: - name: "Get the Authentication Token for the future requests" ansible.builtin.uri: - url: "https://{{ aap_hostname }}/api/v2/tokens/" + url: "https://{{ aap_hostname }}/api/gateway/v1/tokens/" user: "{{ aap_username }}" password: "{{ aap_password }}" method: POST @@ -30,8 +30,8 @@ - name: "Set the oauth token to be used since now" ansible.builtin.set_fact: - controller_oauthtoken: "{{ authtoken_res.json.token }}" - controller_oauthtoken_url: "{{ authtoken_res.json.url }}" + aap_oauthtoken: "{{ authtoken_res.json.token }}" + aap_oauthtoken_url: "{{ authtoken_res.json.url }}" roles: - infra.aap_configuration_extended.filetree_read - infra.aap_configuration.dispatch @@ -39,12 +39,12 @@ post_tasks: - name: "Delete the Authentication Token used" ansible.builtin.uri: - url: "https://{{ aap_hostname }}{{ controller_oauthtoken_url }}" + url: "https://{{ aap_hostname }}{{ aap_oauthtoken_url }}" user: "{{ aap_username }}" password: "{{ aap_password }}" method: DELETE force_basic_auth: true validate_certs: "{{ aap_validate_certs }}" status_code: 204 - when: controller_oauthtoken_url is defined + when: aap_oauthtoken_url is defined ... diff --git a/roles/object_diff/README.md b/roles/object_diff/README.md index be037f87..2069c6bf 100644 --- a/roles/object_diff/README.md +++ b/roles/object_diff/README.md @@ -44,9 +44,9 @@ To correctly manage `roles`, they can only be defined by a super-admin organizat connection: local gather_facts: false vars: - controller_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" - controller_password: "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" - controller_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" + aap_username: "{{ vault_aap_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" + aap_password: "{{ vault_aap_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" + aap_hostname: "{{ vault_aap_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" controller_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}" pre_tasks: @@ -54,9 +54,9 @@ To correctly manage `roles`, they can only be defined by a super-admin organizat block: - name: "Get the Authentication Token for the future requests" ansible.builtin.uri: - url: "https://{{ controller_hostname }}/api/v2/tokens/" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}/api/gateway/v1/tokens/" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: POST force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" @@ -65,10 +65,10 @@ To correctly manage `roles`, they can only be defined by a super-admin organizat - name: "Set the oauth token to be used since now" ansible.builtin.set_fact: - controller_oauthtoken: "{{ authtoken_res.json.token }}" - controller_oauthtoken_url: "{{ authtoken_res.json.url }}" + aap_oauthtoken: "{{ authtoken_res.json.token }}" + aap_oauthtoken_url: "{{ authtoken_res.json.url }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" - when: controller_oauthtoken is not defined + when: aap_oauthtoken is not defined tags: - always @@ -79,7 +79,7 @@ To correctly manage `roles`, they can only be defined by a super-admin organizat controller_configuration_object_diff_tasks: - {name: workflow_job_templates, var: controller_workflows, tags: workflow_job_templates} - {name: job_templates, var: controller_templates, tags: job_templates} - - {name: user_accounts, var: controller_user_accounts, tags: users} + - {name: user_accounts, var: aap_user_accounts, tags: users} - {name: groups, var: controller_groups, tags: groups} - {name: hosts, var: controller_hosts, tags: hosts} - {name: inventory_sources, var: controller_inventory_sources, tags: inventory_sources} @@ -87,13 +87,13 @@ To correctly manage `roles`, they can only be defined by a super-admin organizat - {name: projects, var: controller_projects, tags: projects} - {name: credentials, var: controller_credentials, tags: credentials} - {name: credential_types, var: controller_credential_types, tags: credential_types} - - {name: organizations, var: controller_organizations, tags: organizations} + - {name: organizations, var: aap_organizations, tags: organizations} - role: infra.aap_configuration_extended.dispatch vars: controller_configuration_dispatcher_roles: - {role: workflow_job_templates, var: controller_workflows, tags: workflow_job_templates} - {role: job_templates, var: controller_templates, tags: job_templates} - - {role: users, var: controller_user_accounts, tags: users} + - {role: users, var: aap_user_accounts, tags: users} - {role: groups, var: controller_groups, tags: inventories} - {role: hosts, var: controller_hosts, tags: hosts} - {role: inventory_sources, var: controller_inventory_sources, tags: inventory_sources} @@ -101,19 +101,19 @@ To correctly manage `roles`, they can only be defined by a super-admin organizat - {role: projects, var: controller_projects, tags: projects} - {role: credentials, var: controller_credentials, tags: credentials} - {role: credential_types, var: controller_credential_types, tags: credential_types} - - {role: organizations, var: controller_organizations, tags: organizations} + - {role: organizations, var: aap_organizations, tags: organizations} post_tasks: - name: "Delete the Authentication Token used" ansible.builtin.uri: - url: "https://{{ controller_hostname }}{{ controller_oauthtoken_url }}" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}{{ aap_oauthtoken_url }}" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: DELETE force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" status_code: 204 - when: controller_oauthtoken_url is defined + when: aap_oauthtoken_url is defined $ ansible-playbook drop_diff.yml --tags ${CONTROLLER_OBJECT} -e "{orgs: ${ORGANIZATION}, dir_orgs_vars: orgs_vars, env: ${ENVIRONMENT} }" --vault-password-file ./.vault_pass.txt -e @orgs_vars/env/${ENVIRONMENT}/configure_connection_controller_credentials.yml ${OTHER} ``` diff --git a/roles/object_diff/defaults/main.yml b/roles/object_diff/defaults/main.yml index f910020f..e8eeebc8 100644 --- a/roles/object_diff/defaults/main.yml +++ b/roles/object_diff/defaults/main.yml @@ -7,17 +7,17 @@ query_controller_api_max_objects: 10000 # Automation Controller Object Lists controller_settings: [] -controller_organizations: [] +aap_organizations: [] controller_labels: [] -controller_user_accounts: [] -controller_teams: [] +aap_user_accounts: [] +aap_teams: [] controller_credential_types: [] controller_credentials: [] controller_credential_input_sources: [] controller_notifications: [] controller_projects: [] controller_execution_environments: [] -controller_applications: [] +aap_applications: [] controller_inventories: [] controller_inventory_sources: [] controller_instance_groups: [] @@ -34,11 +34,11 @@ controller_configuration_object_diff_tasks: - {name: workflow_job_templates, var: controller_workflows, tags: workflow_job_templates} - {name: job_templates, var: controller_templates, tags: job_templates} - {name: roles, var: controller_roles, tags: roles} - - {name: teams, var: controller_teams, tags: teams} - - {name: user_accounts, var: controller_user_accounts, tags: users} + - {name: teams, var: aap_teams, tags: teams} + - {name: user_accounts, var: aap_user_accounts, tags: users} - {name: groups, var: controller_groups, tags: groups} - {name: hosts, var: controller_hosts, tags: hosts} - - {name: applications, var: controller_applications, tags: applications} + - {name: applications, var: aap_applications, tags: applications} - {name: execution_environments, var: controller_execution_environments, tags: execution_environments} - {name: inventory_sources, var: controller_inventory_sources, tags: inventory_sources} - {name: inventories, var: controller_inventories, tags: inventories} @@ -46,7 +46,7 @@ controller_configuration_object_diff_tasks: - {name: notification_templates, var: controller_notification_templates, tags: notification_templates} - {name: credentials, var: controller_credentials, tags: credentials} - {name: credential_types, var: controller_credential_types, tags: credential_types} - - {name: organizations, var: controller_organizations, tags: organizations} + - {name: organizations, var: aap_organizations, tags: organizations} - {name: instance_groups, var: controller_instance_groups, tags: instance_groups} controller_configuration_object_diff_secure_logging: "{{ controller_configuration_secure_logging | default(true) }}" diff --git a/roles/object_diff/meta/argument_specs.yml b/roles/object_diff/meta/argument_specs.yml index cd334cfe..fb99233e 100644 --- a/roles/object_diff/meta/argument_specs.yml +++ b/roles/object_diff/meta/argument_specs.yml @@ -46,7 +46,7 @@ argument_specs: required: false description: The state all objects will take unless overridden by object default type: str - controller_hostname: + aap_hostname: default: None required: false description: URL to the Ansible Controller Server. @@ -56,17 +56,17 @@ argument_specs: required: false description: Whether or not to validate the Ansible Controller Server's SSL certificate. type: str - controller_username: + aap_username: default: None required: false description: Admin User on the Ansible Controller Server. Either username / password or oauthtoken need to be specified. type: str - controller_password: + aap_password: default: None required: false description: Controller Admin User's password on the Ansible Controller Server. This should be stored in an Ansible Vault at vars/controller-secrets.yml or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified. type: str - controller_oauthtoken: + aap_oauthtoken: default: None required: false description: Controller Admin User's token on the Ansible Controller Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified. diff --git a/roles/object_diff/tasks/applications.yml b/roles/object_diff/tasks/applications.yml index ad337a87..9cd92746 100644 --- a/roles/object_diff/tasks/applications.yml +++ b/roles/object_diff/tasks/applications.yml @@ -3,25 +3,25 @@ ansible.builtin.set_fact: __controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" - name: "Get the API list of all Applications in Organization {{ orgs }}" ansible.builtin.set_fact: __controller_api_applications: "{{ query(controller_api_plugin, 'applications', query_params={'organization': __controller_organization_id.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" - name: "Find the difference of Application between what is on the Controller versus CasC on SCM" ansible.builtin.set_fact: __applications_difference: "{{ query(controller_role_plugin, - api_list=__controller_api_applications, compare_list=controller_applications, + api_list=__controller_api_applications, compare_list=aap_applications, with_present=include_present_state, set_absent=true) | flatten }}" - name: "Set application's list to be configured" ansible.builtin.set_fact: - controller_applications: "{{ __applications_difference }}" + aap_applications: "{{ __applications_difference }}" ... diff --git a/roles/object_diff/tasks/credential_types.yml b/roles/object_diff/tasks/credential_types.yml index 8b42e43d..bf7d3eba 100644 --- a/roles/object_diff/tasks/credential_types.yml +++ b/roles/object_diff/tasks/credential_types.yml @@ -4,7 +4,7 @@ ansible.builtin.set_fact: __controller_api_credential_types: "{{ query(controller_api_plugin, 'credential_types', query_params={'managed': false}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -14,7 +14,7 @@ ansible.builtin.set_fact: __controller_api_credential_types: "{{ query(controller_api_plugin, 'credential_types', query_params={'managed_by_tower': false}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" diff --git a/roles/object_diff/tasks/credentials.yml b/roles/object_diff/tasks/credentials.yml index 8929bf44..9ccbf078 100644 --- a/roles/object_diff/tasks/credentials.yml +++ b/roles/object_diff/tasks/credentials.yml @@ -4,7 +4,7 @@ ansible.builtin.set_fact: __controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -12,7 +12,7 @@ ansible.builtin.set_fact: __controller_api_credentials: "{{ query(controller_api_plugin, 'credentials', query_params={'organization': __controller_organization_id.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" diff --git a/roles/object_diff/tasks/execution_environments.yml b/roles/object_diff/tasks/execution_environments.yml index b6e0fb68..73c87b4c 100644 --- a/roles/object_diff/tasks/execution_environments.yml +++ b/roles/object_diff/tasks/execution_environments.yml @@ -6,14 +6,14 @@ ansible.builtin.set_fact: __controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" - name: "Get the API list of all Execution Environments in Organization {{ orgs }}" ansible.builtin.set_fact: __controller_api_execution_environments: "{{ query(controller_api_plugin, 'execution_environments', query_params={'organization': __controller_organization_id.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" diff --git a/roles/object_diff/tasks/groups.yml b/roles/object_diff/tasks/groups.yml index 174bd67a..b413c7bc 100644 --- a/roles/object_diff/tasks/groups.yml +++ b/roles/object_diff/tasks/groups.yml @@ -3,7 +3,7 @@ ansible.builtin.set_fact: controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -15,7 +15,7 @@ 'not__total_groups': '0', 'not__kind': 'smart', 'not__kind': 'constructed'}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -24,7 +24,7 @@ ansible.builtin.set_fact: __controller_api_groups: "{{ (__controller_api_groups | default([])) + query(controller_api_plugin, 'groups', query_params={'inventory': current_inventory.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" loop: "{{ __controller_api_inventories }}" diff --git a/roles/object_diff/tasks/hosts.yml b/roles/object_diff/tasks/hosts.yml index 44bb1286..ab6efcf3 100644 --- a/roles/object_diff/tasks/hosts.yml +++ b/roles/object_diff/tasks/hosts.yml @@ -3,7 +3,7 @@ ansible.builtin.set_fact: controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -15,7 +15,7 @@ 'not__total_hosts': '0', 'not__kind': 'smart', 'not__kind': 'constructed'}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -24,7 +24,7 @@ ansible.builtin.set_fact: __controller_api_hosts: "{{ (__controller_api_hosts | default([])) + query(controller_api_plugin, 'hosts', query_params={'inventory': current_inventory.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" diff --git a/roles/object_diff/tasks/instance_groups.yml b/roles/object_diff/tasks/instance_groups.yml index cad21278..c72bf120 100644 --- a/roles/object_diff/tasks/instance_groups.yml +++ b/roles/object_diff/tasks/instance_groups.yml @@ -2,7 +2,7 @@ - name: "Get the current controller user to determine if it is super-admin" ansible.builtin.set_fact: __controller_api_current_user_check_is_admin: "{{ lookup(controller_api_plugin, 'me', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" - name: "Instance Group differences (block)" @@ -12,7 +12,7 @@ - name: "Get the API list of all instance_groups" ansible.builtin.set_fact: __controller_api_instance_groups: "{{ query(controller_api_plugin, 'instance_groups', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" diff --git a/roles/object_diff/tasks/inventories.yml b/roles/object_diff/tasks/inventories.yml index e407bf36..b9b56473 100644 --- a/roles/object_diff/tasks/inventories.yml +++ b/roles/object_diff/tasks/inventories.yml @@ -3,7 +3,7 @@ ansible.builtin.set_fact: __controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -11,7 +11,7 @@ ansible.builtin.set_fact: __controller_api_inventories: "{{ query(controller_api_plugin, 'inventories', query_params={'organization': __controller_organization_id.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" diff --git a/roles/object_diff/tasks/inventory_sources.yml b/roles/object_diff/tasks/inventory_sources.yml index f1cde6c2..963154f2 100644 --- a/roles/object_diff/tasks/inventory_sources.yml +++ b/roles/object_diff/tasks/inventory_sources.yml @@ -3,7 +3,7 @@ ansible.builtin.set_fact: __controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -11,7 +11,7 @@ ansible.builtin.set_fact: __controller_api_inventory_sources: "{{ query(controller_api_plugin, 'inventory_sources', query_params={'organization': __controller_organization_id.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" diff --git a/roles/object_diff/tasks/job_templates.yml b/roles/object_diff/tasks/job_templates.yml index 84b8fc57..a2e323b6 100644 --- a/roles/object_diff/tasks/job_templates.yml +++ b/roles/object_diff/tasks/job_templates.yml @@ -3,7 +3,7 @@ ansible.builtin.set_fact: __controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -11,7 +11,7 @@ ansible.builtin.set_fact: __controller_api_job_templates: "{{ query(controller_api_plugin, 'job_templates', query_params={'organization': __controller_organization_id.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" diff --git a/roles/object_diff/tasks/main.yml b/roles/object_diff/tasks/main.yml index 246e0b0b..fc8f3169 100644 --- a/roles/object_diff/tasks/main.yml +++ b/roles/object_diff/tasks/main.yml @@ -53,7 +53,7 @@ - name: "Check if the connection is to an Ansible Tower or to Automation Platform" ansible.builtin.set_fact: is_aap: "{{ lookup(controller_api_plugin, 'ping', - host=controller_hostname, oauth_token=controller_oauthtoken, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs).version is version('4.0.0', '>=') }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" tags: diff --git a/roles/object_diff/tasks/notification_templates.yml b/roles/object_diff/tasks/notification_templates.yml index 4308c6fd..1f5569fb 100644 --- a/roles/object_diff/tasks/notification_templates.yml +++ b/roles/object_diff/tasks/notification_templates.yml @@ -3,14 +3,14 @@ ansible.builtin.set_fact: __controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" - name: "Get the API list of all Notification Templates in Organization {{ orgs }}" ansible.builtin.set_fact: __controller_api_notification_templates: "{{ query(controller_api_plugin, 'notification_templates', query_params={'organization': __controller_organization_id.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" diff --git a/roles/object_diff/tasks/organizations.yml b/roles/object_diff/tasks/organizations.yml index 7497eb81..3754536d 100644 --- a/roles/object_diff/tasks/organizations.yml +++ b/roles/object_diff/tasks/organizations.yml @@ -2,7 +2,7 @@ - name: "Get the current controller user to determine if it is super-admin" ansible.builtin.set_fact: __controller_api_current_user_check_is_admin: "{{ lookup(controller_api_plugin, 'me', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -13,7 +13,7 @@ - name: "Gets current Organizations configured" ansible.builtin.set_fact: __controller_api_organizations: "{{ query(controller_api_plugin, 'organizations', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -21,7 +21,7 @@ - name: "Find the difference of Organizations between what is on the Controller versus curated list." ansible.builtin.set_fact: __organizations_difference: "{{ query(controller_role_plugin, - api_list=__controller_api_organizations, compare_list=controller_organizations, + api_list=__controller_api_organizations, compare_list=aap_organizations, with_present=include_present_state, set_absent=true) | flatten }}" @@ -36,23 +36,23 @@ - protect_not_empty_orgs is defined - protect_not_empty_orgs - query(controller_api_plugin, 'api/' + controller_api_version + '/organizations/' + (__organizations_difference_list_empty_item.name | urlencode) + '/users/', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 - query(controller_api_plugin, 'api/' + controller_api_version + '/organizations/' + (__organizations_difference_list_empty_item.name | urlencode) + '/admins/', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 - query(controller_api_plugin, 'api/' + controller_api_version + '/organizations/' + (__organizations_difference_list_empty_item.name | urlencode) + '/inventories/', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 - query(controller_api_plugin, 'api/' + controller_api_version + '/organizations/' + (__organizations_difference_list_empty_item.name | urlencode) + '/teams/', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 - query(controller_api_plugin, 'api/' + controller_api_version + '/organizations/' + (__organizations_difference_list_empty_item.name | urlencode) + '/projects/', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 - query(controller_api_plugin, 'api/' + controller_api_version + '/organizations/' + (__organizations_difference_list_empty_item.name | urlencode) + '/job_templates/', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 - query(controller_api_plugin, 'api/' + controller_api_version + '/organizations/' + (__organizations_difference_list_empty_item.name | urlencode) + '/workflow_job_templates/', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) | length == 0 - name: "Set Organization differences" ansible.builtin.set_fact: - __controller_organizations: "{{ __controller_organizations | default([]) + [__organizations_difference_item] }}" + __aap_organizations: "{{ __aap_organizations | default([]) + [__organizations_difference_item] }}" loop: "{{ __organizations_difference }}" loop_control: loop_var: __organizations_difference_item @@ -62,5 +62,5 @@ - name: "Set organization's list to be configured" ansible.builtin.set_fact: - controller_organizations: "{{ __controller_organizations | default([]) }}" + aap_organizations: "{{ __aap_organizations | default([]) }}" ... diff --git a/roles/object_diff/tasks/projects.yml b/roles/object_diff/tasks/projects.yml index b9e33805..1addfb1b 100644 --- a/roles/object_diff/tasks/projects.yml +++ b/roles/object_diff/tasks/projects.yml @@ -3,7 +3,7 @@ ansible.builtin.set_fact: __controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -11,7 +11,7 @@ ansible.builtin.set_fact: __controller_api_projects: "{{ query(controller_api_plugin, 'projects', query_params={'organization': __controller_organization_id.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" diff --git a/roles/object_diff/tasks/roles.yml b/roles/object_diff/tasks/roles.yml index 97d56dab..6fb41a5f 100644 --- a/roles/object_diff/tasks/roles.yml +++ b/roles/object_diff/tasks/roles.yml @@ -2,7 +2,7 @@ - name: "Get the current controller user to determine if it is super-admin" ansible.builtin.set_fact: __controller_api_current_user_check_is_admin: "{{ lookup(controller_api_plugin, 'me', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -26,15 +26,15 @@ }}" vars: current_users: "{{ query(controller_api_plugin, current_role.related.users, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) | map(attribute='username') }}" current_teams: "{{ query(controller_api_plugin, current_role.related.teams, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) | map(attribute='name') }}" loop: "{{ query(controller_api_plugin, 'roles', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" loop_control: diff --git a/roles/object_diff/tasks/schedules.yml b/roles/object_diff/tasks/schedules.yml index 8a88febf..f3f77cfa 100644 --- a/roles/object_diff/tasks/schedules.yml +++ b/roles/object_diff/tasks/schedules.yml @@ -3,19 +3,19 @@ ansible.builtin.set_fact: __controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" - name: "Get the API list of all WF and Job Templates in Organization {{ orgs }}" ansible.builtin.set_fact: __controller_api_job_templates: "{{ query(controller_api_plugin, 'job_templates', query_params={'organization': __controller_organization_id.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" __controller_api_workflow_job_templates: "{{ query(controller_api_plugin, 'workflow_job_templates', query_params={'organization': __controller_organization_id.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" @@ -26,7 +26,7 @@ - name: "Get the API list of all Schedules" ansible.builtin.set_fact: __controller_api_schedules_prefilter: "{{ query(controller_api_plugin, 'schedules', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" diff --git a/roles/object_diff/tasks/teams.yml b/roles/object_diff/tasks/teams.yml index 70a7d5b5..c6a247bc 100644 --- a/roles/object_diff/tasks/teams.yml +++ b/roles/object_diff/tasks/teams.yml @@ -2,7 +2,7 @@ - name: "Get the current controller user to determine if it is super-admin" ansible.builtin.set_fact: __controller_api_current_user_check_is_admin: "{{ lookup(controller_api_plugin, 'me', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -14,7 +14,7 @@ ansible.builtin.set_fact: __controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -22,7 +22,7 @@ ansible.builtin.set_fact: __controller_api_teams: "{{ query(controller_api_plugin, 'teams', query_params={'organization': __controller_organization_id.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -31,12 +31,12 @@ ansible.builtin.set_fact: __teams_difference: "{{ query(controller_role_plugin, api_list=__controller_api_teams, - compare_list=controller_teams, + compare_list=aap_teams, with_present=include_present_state, set_absent=true) | flatten }}" - name: "Sets the difference of Teams between what is on the Controller versus CasC on SCM" ansible.builtin.set_fact: - controller_teams: "{{ __teams_difference }}" + aap_teams: "{{ __teams_difference }}" ... diff --git a/roles/object_diff/tasks/user_accounts.yml b/roles/object_diff/tasks/user_accounts.yml index b8109dd6..d45af22d 100644 --- a/roles/object_diff/tasks/user_accounts.yml +++ b/roles/object_diff/tasks/user_accounts.yml @@ -3,14 +3,14 @@ - name: "Get the current controller user to determine if it is super-admin" ansible.builtin.set_fact: __controller_api_current_user_check_is_admin: "{{ lookup(controller_api_plugin, 'me', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" - name: "Get all users from the API" ansible.builtin.set_fact: __controller_api_user_accounts: "{{ query(controller_api_plugin, 'users', - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -36,13 +36,13 @@ - name: "Find the difference of User Accounts between what is on the Controller versus CasC on SCM" ansible.builtin.set_fact: __user_accounts_difference: "{{ query(controller_role_plugin, - api_list=__controller_api_user_accounts, compare_list=controller_user_accounts, + api_list=__controller_api_user_accounts, compare_list=aap_user_accounts, with_present=include_present_state, set_absent=true) | flatten }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" - name: "Sets the difference of User Accounts between what is on the Controller versus CasC on SCM" ansible.builtin.set_fact: - controller_user_accounts: "{{ __user_accounts_difference }}" + aap_user_accounts: "{{ __user_accounts_difference }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" ... diff --git a/roles/object_diff/tasks/workflow_job_templates.yml b/roles/object_diff/tasks/workflow_job_templates.yml index cf7f05ff..aa2f66ad 100644 --- a/roles/object_diff/tasks/workflow_job_templates.yml +++ b/roles/object_diff/tasks/workflow_job_templates.yml @@ -3,7 +3,7 @@ ansible.builtin.set_fact: __controller_organization_id: "{{ lookup(controller_api_plugin, 'organizations', query_params={'name': orgs}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" @@ -11,7 +11,7 @@ ansible.builtin.set_fact: __controller_api_workflow_job_templates: "{{ query(controller_api_plugin, 'workflow_job_templates', query_params={'organization': __controller_organization_id.id}, - host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, + host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) }}" no_log: "{{ controller_configuration_object_diff_secure_logging }}" diff --git a/roles/object_diff/tests/drop_diff.yml b/roles/object_diff/tests/drop_diff.yml index 90c638dd..a67de63e 100644 --- a/roles/object_diff/tests/drop_diff.yml +++ b/roles/object_diff/tests/drop_diff.yml @@ -4,23 +4,23 @@ connection: local gather_facts: false vars: - controller_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" - controller_password: "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" - controller_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" + aap_username: "{{ vault_aap_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" + aap_password: "{{ vault_aap_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" + aap_hostname: "{{ vault_aap_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" controller_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}" pre_tasks: - name: "Setup authentication (block)" no_log: "{{ controller_configuration_object_diff_secure_logging }}" - when: controller_oauthtoken is not defined + when: aap_oauthtoken is not defined tags: - always block: - name: "Get the Authentication Token for the future requests" ansible.builtin.uri: - url: "https://{{ controller_hostname }}/api/v2/tokens/" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}/api/gateway/v1/tokens/" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: POST force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" @@ -29,8 +29,8 @@ - name: "Set the oauth token to be used since now" ansible.builtin.set_fact: - controller_oauthtoken: "{{ authtoken_res.json.token }}" - controller_oauthtoken_url: "{{ authtoken_res.json.url }}" + aap_oauthtoken: "{{ authtoken_res.json.token }}" + aap_oauthtoken_url: "{{ authtoken_res.json.url }}" roles: - role: infra.aap_configuration_extended.filetree_read @@ -41,8 +41,8 @@ - {role: workflow_job_templates, var: controller_workflows, tags: workflow_job_templates} - {role: job_templates, var: controller_templates, tags: job_templates} - {role: roles, var: controller_roles, tags: roles} - - {role: teams, var: controller_teams, tags: teams} - - {role: users, var: controller_user_accounts, tags: users} + - {role: teams, var: aap_teams, tags: teams} + - {role: users, var: aap_user_accounts, tags: users} - {role: groups, var: controller_groups, tags: inventories} - {role: hosts, var: controller_hosts, tags: hosts} - {role: inventory_sources, var: controller_inventory_sources, tags: inventory_sources} @@ -50,19 +50,19 @@ - {role: projects, var: controller_projects, tags: projects} - {role: credentials, var: controller_credentials, tags: credentials} - {role: credential_types, var: controller_credential_types, tags: credential_types} - - {role: organizations, var: controller_organizations, tags: organizations} + - {role: organizations, var: aap_organizations, tags: organizations} post_tasks: - name: "Delete the Authentication Token used" ansible.builtin.uri: - url: "https://{{ controller_hostname }}{{ controller_oauthtoken_url }}" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}{{ aap_oauthtoken_url }}" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: DELETE force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" status_code: 204 - when: controller_oauthtoken_url is defined + when: aap_oauthtoken_url is defined tags: - always ... diff --git a/roles/object_diff/tests/object_diff.yml b/roles/object_diff/tests/object_diff.yml index c4933c7e..f4c10cce 100644 --- a/roles/object_diff/tests/object_diff.yml +++ b/roles/object_diff/tests/object_diff.yml @@ -4,23 +4,23 @@ connection: local gather_facts: false vars: - controller_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" - controller_password: "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" - controller_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" + aap_username: "{{ vault_aap_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" + aap_password: "{{ vault_aap_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" + aap_hostname: "{{ vault_aap_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" controller_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}" pre_tasks: - name: "Setup authentication (block)" no_log: "{{ controller_configuration_object_diff_secure_logging }}" - when: controller_oauthtoken is not defined + when: aap_oauthtoken is not defined tags: - always block: - name: "Get the Authentication Token for the future requests" ansible.builtin.uri: - url: "https://{{ controller_hostname }}/api/v2/tokens/" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}/api/gateway/v1/tokens/" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: POST force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" @@ -29,8 +29,8 @@ - name: "Set the oauth token to be used since now" ansible.builtin.set_fact: - controller_oauthtoken: "{{ authtoken_res.json.token }}" - controller_oauthtoken_url: "{{ authtoken_res.json.url }}" + aap_oauthtoken: "{{ authtoken_res.json.token }}" + aap_oauthtoken_url: "{{ authtoken_res.json.url }}" roles: - infra.aap_configuration_extended.filetree_read - infra.aap_configuration_extended.object_diff @@ -38,14 +38,14 @@ post_tasks: - name: "Delete the Authentication Token used" ansible.builtin.uri: - url: "https://{{ controller_hostname }}{{ controller_oauthtoken_url }}" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}{{ aap_oauthtoken_url }}" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: DELETE force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" status_code: 204 - when: controller_oauthtoken_url is defined + when: aap_oauthtoken_url is defined tags: - always ... diff --git a/tests/automatetheautomation/config-controller-filetree.yml b/tests/automatetheautomation/config-controller-filetree.yml new file mode 120000 index 00000000..a945067b --- /dev/null +++ b/tests/automatetheautomation/config-controller-filetree.yml @@ -0,0 +1 @@ +../../roles/filetree_read/tests/config-controller-filetree.yml \ No newline at end of file diff --git a/tests/automatetheautomation/drop_diff.yml b/tests/automatetheautomation/drop_diff.yml new file mode 120000 index 00000000..ec2eedef --- /dev/null +++ b/tests/automatetheautomation/drop_diff.yml @@ -0,0 +1 @@ +../../roles/object_diff/tests/drop_diff.yml \ No newline at end of file diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_aap_monitor.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_aap_monitor.yml new file mode 100644 index 00000000..33ed2079 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_aap_monitor.yml @@ -0,0 +1,22 @@ +--- +controller_credential_types: + - name: "AAP_Monitor" + description: "Monitor Ansible Automation Platform credential" + kind: "cloud" + inputs: + fields: + - id: controller_url + label: Controller + type: string + - id: oauthtoken + label: Token + secret: true + type: string + required: + - controller_url + - oauthtoken + injectors: + extra_vars: + local_users_controller_api_token: !unsafe '{{ oauthtoken }}' + local_users_controller_api_url: !unsafe '{{ controller_url }}' +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_acme_key.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_acme_key.yml new file mode 100644 index 00000000..ae04404d --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_acme_key.yml @@ -0,0 +1,16 @@ +--- +controller_credential_types: + - name: "ACME Account Key" + description: "Account Key for Sectigo CA ACME API" + kind: "cloud" + inputs: + fields: + - id: key + label: ACME Account Key + type: string + required: + - key + injectors: + extra_vars: + acme_account_key: !unsafe '{{ key }}' +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_cloudforms.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_cloudforms.yml new file mode 100644 index 00000000..eeda7623 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_cloudforms.yml @@ -0,0 +1,35 @@ +--- +controller_credential_types: + - name: "Credential Type for CloudForms" + description: "Credential Type for CloudForms" + kind: "cloud" + inputs: + fields: + - id: host + type: string + label: CloudForms URL + help_text: >- + Enter the URL for the virtual machine that corresponds to your CloudForms + instance. For example, https://cloudforms.example.org + - id: username + type: string + label: Username + - id: password + type: string + label: Password + secret: true + - id: ssl_verify + type: string + label: SSL Verify + default: 'True' + required: + - username + - password + - host + injectors: + env: + CLOUDFORMS_URL: !unsafe '{{ host }}' + CLOUDFORMS_USERNAME: !unsafe '{{ username }}' + CLOUDFORMS_PASSWORD: !unsafe '{{ password }}' + CLOUDFORMS_SSL_VERIFY: !unsafe '{{ ssl_verify }}' +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_multiple.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_multiple.yml new file mode 100644 index 00000000..f6968618 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_multiple.yml @@ -0,0 +1,22 @@ +--- +controller_credential_types: + - name: "Machine Credential Dual" + description: "Multiple Machine Credentials" + kind: "cloud" + inputs: + fields: + - type: string + id: my_user + label: Username + - secret: true + type: string + id: my_pass + label: Password + required: + - my_user + - my_pass + injectors: + extra_vars: + my_pass: !unsafe '{{my_pass}}' + my_user: !unsafe '{{my_user}}' +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_servicenow.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_servicenow.yml new file mode 100644 index 00000000..86fcd653 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/app-example/controller_credential_types_servicenow.yml @@ -0,0 +1,27 @@ +--- +controller_credential_types: + - name: "ServiceNow" + description: "Credential Type for ServiceNow" + kind: "cloud" + inputs: + fields: + - id: SN_USERNAME + type: string + label: Username + - id: SN_PASSWORD + type: string + label: Password + secret: true + - id: SN_INSTANCE + type: string + label: Snow Instance + required: + - SN_USERNAME + - SN_PASSWORD + - SN_INSTANCE + injectors: + env: + SN_INSTANCE: !unsafe '{{ SN_INSTANCE }}' + SN_PASSWORD: !unsafe '{{ SN_PASSWORD }}' + SN_USERNAME: !unsafe '{{ SN_USERNAME }}' +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/controller_credential_types.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/controller_credential_types.yml new file mode 100644 index 00000000..e8d39b81 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_credential_types.d/controller_credential_types.yml @@ -0,0 +1,3 @@ +--- +controller_credential_types: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_groups.d/controller_groups.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_groups.d/controller_groups.yml new file mode 100644 index 00000000..65297e07 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_groups.d/controller_groups.yml @@ -0,0 +1,3 @@ +--- +controller_groups: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_instance_groups.d/app-example/controller_instance_groups_otlc.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_instance_groups.d/app-example/controller_instance_groups_otlc.yml new file mode 100644 index 00000000..4becb588 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_instance_groups.d/app-example/controller_instance_groups_otlc.yml @@ -0,0 +1,20 @@ +--- +configure_controller_instance_groups: + - name: Container_Groups_Instance + is_container_group: true + credential: "{{ orgs }} {{ env }} OCP_OPENTLC" + pod_spec_override: | + apiVersion: v1 + kind: Pod + metadata: + namespace: controller-container-group + spec: + containers: + - image: >- + registry.redhat.io/ansible-automation-platform-22/ee-supported-rhel8:latest + name: worker + args: + - ansible-runner + - worker + - '--private-data-dir=/runner' +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_instance_groups.d/controller_instance_groups.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_instance_groups.d/controller_instance_groups.yml new file mode 100644 index 00000000..9392c9c6 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_instance_groups.d/controller_instance_groups.yml @@ -0,0 +1,3 @@ +--- +configure_controller_instance_groups: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/app-casc/controller_inventories_localhost.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/app-casc/controller_inventories_localhost.yml new file mode 100644 index 00000000..4eb612ef --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/app-casc/controller_inventories_localhost.yml @@ -0,0 +1,6 @@ +--- +controller_inventories: + - name: "{{ orgs }} Localhost" + description: "Inventory for the Localhost" + organization: "{{ orgs }}" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/app-example/controller_inventories_excel.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/app-example/controller_inventories_excel.yml new file mode 100644 index 00000000..fd195580 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/app-example/controller_inventories_excel.yml @@ -0,0 +1,6 @@ +--- +controller_inventories: + - name: "InventaryExcel" + description: "Inventory Taken from excel file" + organization: "{{ orgs }}" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/app-example/controller_inventories_smart_org1.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/app-example/controller_inventories_smart_org1.yml new file mode 100644 index 00000000..d37eba26 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/app-example/controller_inventories_smart_org1.yml @@ -0,0 +1,32 @@ +--- +controller_inventories: + - name: "SmartInventory URGENT CHANGES CPD BCN Org1" + description: "SmartInventory CPD BCN Org1" + host_filter: "groups__name=Patching_cpd_bcn and groups__name=Patching_os_entorno_{{ env }} and groups__name=Patching_os_vendor_redhat and groups__name=Patching_area_org01 and groups__name=Patching_parcheo_ch_planif_ch00001" + kind: smart + organization: "{{ orgs }}" + + - name: "SmartInventory CPD BCN Org1 dev" + description: "SmartInventory CPD BCN Org1" + host_filter: "groups__name=Patching_cpd_bcn and groups__name=Patching_os_entorno_dev and groups__name=Patching_os_vendor_redhat and groups__name=Patching_area_org01" + kind: smart + organization: "{{ orgs }}" + + - name: "SmartInventory CPD MAD Org1 dev" + description: "SmartInventory CPD MAD Org1" + host_filter: "groups__name=Patching_cpd_mad and groups__name=Patching_os_entorno_dev and groups__name=Patching_os_vendor_redhat and groups__name=Patching_area_org01" + kind: smart + organization: "{{ orgs }}" + + - name: "SmartInventory CPD BCN Org1 prod" + description: "SmartInventory CPD BCN Org1" + host_filter: "groups__name=Patching_cpd_bcn and groups__name=Patching_os_entorno_prod and groups__name=Patching_os_vendor_redhat and groups__name=Patching_area_org01" + kind: smart + organization: "{{ orgs }}" + + - name: "SmartInventory CPD MAD Org1 prod" + description: "SmartInventory CPD MAD Org1" + host_filter: "groups__name=Patching_cpd_mad and groups__name=Patching_os_entorno_prod and groups__name=Patching_os_vendor_redhat and groups__name=Patching_area_org01" + kind: smart + organization: "{{ orgs }}" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/app-example/controller_inventories_smart_org2.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/app-example/controller_inventories_smart_org2.yml new file mode 100644 index 00000000..1dc3b34a --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/app-example/controller_inventories_smart_org2.yml @@ -0,0 +1,26 @@ +--- +controller_inventories: + - name: "SmartInventory CPD BCN Org2 dev" + description: "SmartInventory CPD BCN Org2" + host_filter: "groups__name=Patching_cpd_bcn and groups__name=Patching_os_entorno_dev and groups__name=Patching_os_vendor_redhat and groups__name=Patching_area_org02" + kind: smart + organization: "{{ orgs }}" + + - name: "SmartInventory CPD MAD Org2 dev" + description: "SmartInventory CPD MAD Org2" + host_filter: "groups__name=Patching_cpd_mad and groups__name=Patching_os_entorno_dev and groups__name=Patching_os_vendor_redhat and groups__name=Patching_area_org02" + kind: smart + organization: "{{ orgs }}" + + - name: "SmartInventory CPD BCN Org2 prod" + description: "SmartInventory CPD BCN Org2" + host_filter: "groups__name=Patching_cpd_bcn and groups__name=Patching_os_entorno_prod and groups__name=Patching_os_vendor_redhat and groups__name=Patching_area_org02" + kind: smart + organization: "{{ orgs }}" + + - name: "SmartInventory CPD MAD Org2 prod" + description: "SmartInventory CPD MAD Org2" + host_filter: "groups__name=Patching_cpd_mad and groups__name=Patching_os_entorno_prod and groups__name=Patching_os_vendor_redhat and groups__name=Patching_area_org02" + kind: smart + organization: "{{ orgs }}" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/controller_inventories.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/controller_inventories.yml new file mode 100644 index 00000000..059d77c0 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_inventories.d/controller_inventories.yml @@ -0,0 +1,3 @@ +--- +controller_inventories: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_job_templates.d/app-casc/controller_job_templates_casc.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_job_templates.d/app-casc/controller_job_templates_casc.yml new file mode 100644 index 00000000..137c2ba5 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_job_templates.d/app-casc/controller_job_templates_casc.yml @@ -0,0 +1,62 @@ +--- +controller_templates: + - name: "{{ orgs }} CasC_JobTemplates_AAP_CI_Webhook" + description: "Template to attend AAP CasC webhook" + organization: "{{ orgs }}" + project: "{{ orgs }} CasC_Data" + inventory: "{{ orgs }} Localhost" + playbook: "config-controller.yml" + job_tags: ci_webhook_trigger + job_type: run + fact_caching_enabled: false + credentials: + - "{{ orgs }} {{ env }} aap_credentials" + concurrent_jobs_enabled: true + ask_scm_branch_on_launch: true + extra_vars: + ansible_python_interpreter: /usr/bin/python3 + ansible_async_dir: /home/runner/.ansible_async/ + execution_environment: "ee-casc" + + - name: "{{ orgs }} CasC_JobTemplates_AAP_CI_Config_Controller" + description: "Template to deploy AAP Orgs" + organization: "{{ orgs }}" + project: "{{ orgs }} CasC_Data" + inventory: "{{ orgs }} Localhost" + playbook: "config-controller.yml" + job_type: run + fact_caching_enabled: false + credentials: + - "{{ orgs }} {{ env }} aap_credentials" + - "{{ orgs }} {{ env }} aap_vault_credentials" + concurrent_jobs_enabled: true + ask_scm_branch_on_launch: true + ask_tags_on_launch: true + ask_verbosity_on_launch: true + ask_variables_on_launch: true + extra_vars: + ansible_python_interpreter: /usr/bin/python3 + ansible_async_dir: /home/runner/.ansible_async/ + execution_environment: "ee-casc" + + - name: "{{ orgs }} CasC_JobTemplates_AAP_Desired_State" + description: "Template to assure Desired State" + organization: "{{ orgs }}" + project: "{{ orgs }} CasC_Data" + inventory: "{{ orgs }} Localhost" + playbook: "desired-state.yml" + job_type: run + fact_caching_enabled: false + credentials: + - "{{ orgs }} {{ env }} aap_credentials" + - "{{ orgs }} {{ env }} aap_vault_credentials" + concurrent_jobs_enabled: true + ask_scm_branch_on_launch: true + ask_tags_on_launch: true + ask_verbosity_on_launch: true + ask_variables_on_launch: true + extra_vars: + ansible_python_interpreter: /usr/bin/python3 + ansible_async_dir: /home/runner/.ansible_async/ + execution_environment: "ee-casc" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_job_templates.d/app-example/controller_job_templates_container_groups.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_job_templates.d/app-example/controller_job_templates_container_groups.yml new file mode 100644 index 00000000..734b6d59 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_job_templates.d/app-example/controller_job_templates_container_groups.yml @@ -0,0 +1,16 @@ +--- +controller_templates: + - name: "{{ orgs }} JT_Container_Group" + description: "Template to test Container Groups" + organization: "{{ orgs }}" + project: "{{ orgs }} Container_Group" + inventory: "{{ orgs }} Localhost" + playbook: "helloworld.yml" + job_type: run + concurrent_jobs_enabled: true + credentials: + - "{{ orgs }} {{ env }} aap_vault_credentials" + execution_environment: "Default execution environment" + instance_groups: + - Container_Groups_Instance +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_job_templates.d/app-example/controller_job_templates_demo_push.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_job_templates.d/app-example/controller_job_templates_demo_push.yml new file mode 100644 index 00000000..42675006 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_job_templates.d/app-example/controller_job_templates_demo_push.yml @@ -0,0 +1,46 @@ +--- +controller_templates: + - name: "{{ orgs }} JT_Container_Group TEST DEMO First Push" + description: "Template to test Container Groups" + organization: "{{ orgs }}" + project: "{{ orgs }} Container_Group" + inventory: "{{ orgs }} Localhost" + playbook: "helloworld.yml" + job_type: run + concurrent_jobs_enabled: true + credentials: + - "{{ orgs }} {{ env }} aap_vault_credentials" + execution_environment: "Default execution environment" + instance_groups: + - Container_Groups_Instance + + - name: "{{ orgs }} JT_Container_Group TEST DEMO - Second Push" + description: "Template to test Container Groups" + organization: "{{ orgs }}" + project: "{{ orgs }} Container_Group" + inventory: "{{ orgs }} Localhost" + playbook: "helloworld.yml" + job_type: run + concurrent_jobs_enabled: true + credentials: + - "{{ orgs }} {{ env }} aap_vault_credentials" + execution_environment: "Default execution environment" + instance_groups: + - Container_Groups_Instance + survey_enabled: true + survey_spec: + name: 'TEST' + description: 'Test' + spec: + - question_name: Target Host + question_description: target host is required for playbook to work, this host + needs to exist in the inventory + required: true + type: text + variable: target_hosts + min: 0 + max: 1024 + default: Localhost + choices: '' + new_question: true +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_job_templates.d/controller_job_templates.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_job_templates.d/controller_job_templates.yml new file mode 100644 index 00000000..b04efcaa --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_job_templates.d/controller_job_templates.yml @@ -0,0 +1,3 @@ +--- +controller_templates: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/app-casc/controller_organizations_Global.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/app-casc/controller_organizations_Global.yml new file mode 100644 index 00000000..9c52cfb5 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/app-casc/controller_organizations_Global.yml @@ -0,0 +1,10 @@ +--- +controller_organizations: + - name: "{{ orgs }}" + description: "Organization for globally available objects" + galaxy_credentials: + - "Ansible Galaxy" + - "{{ orgs }} {{ env }} Automation Hub Community Repository" + - "{{ orgs }} {{ env }} Automation Hub Published Repository" + - "{{ orgs }} {{ env }} Automation Hub RH Certified Repository" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/app-example/controller_organizations_ExampleOrg.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/app-example/controller_organizations_ExampleOrg.yml new file mode 100644 index 00000000..04212af8 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/app-example/controller_organizations_ExampleOrg.yml @@ -0,0 +1,10 @@ +--- +controller_organizations: + - name: "ExampleOrg" + description: "Organization Example" + galaxy_credentials: + - "Ansible Galaxy" + - "{{ orgs }} {{ env }} Automation Hub Community Repository" + - "{{ orgs }} {{ env }} Automation Hub Published Repository" + - "{{ orgs }} {{ env }} Automation Hub RH Certified Repository" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/app-example/controller_organizations_OrgCrossTeams.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/app-example/controller_organizations_OrgCrossTeams.yml new file mode 100644 index 00000000..d6903618 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/app-example/controller_organizations_OrgCrossTeams.yml @@ -0,0 +1,5 @@ +--- +controller_organizations: + - name: "OrgCrossTeams" + description: "Organization to run playbooks Cross Teams" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/app-example/controller_organizations_Organizations1-2.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/app-example/controller_organizations_Organizations1-2.yml new file mode 100644 index 00000000..1fe8e3cf --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/app-example/controller_organizations_Organizations1-2.yml @@ -0,0 +1,11 @@ +--- +controller_organizations: + - name: "Organization1" + description: "Organization 1 to tests" + galaxy_credentials: "{{ common_galaxy_credentials }}" + - name: "Organization2" + description: "Organization 2 to tests" + galaxy_credentials: "{{ common_galaxy_credentials }}" +common_galaxy_credentials: + - "Ansible Galaxy" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/controller_organizations.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/controller_organizations.yml new file mode 100644 index 00000000..65f88a49 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_organizations.d/controller_organizations.yml @@ -0,0 +1,3 @@ +--- +controller_organizations: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/app-casc/controller_projects_casc.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/app-casc/controller_projects_casc.yml new file mode 100644 index 00000000..539fb858 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/app-casc/controller_projects_casc.yml @@ -0,0 +1,15 @@ +--- +controller_projects: + - name: "{{ orgs }} CasC_Data" + description: "Project to include the vars values of the {{ orgs }} Org" + organization: "{{ orgs }}" + scm_type: git + scm_url: "git@gitlab.com:automationiberia.com/global.git" + scm_credential: "{{ orgs }} {{ env }} Gitlab Credential" + scm_branch: "{{ env }}" + scm_clean: false + scm_delete_on_update: false + scm_update_on_launch: false + scm_update_cache_timeout: 86400 + allow_override: true +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/app-ocp/controller_projects_container_groups.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/app-ocp/controller_projects_container_groups.yml new file mode 100644 index 00000000..3e29f19f --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/app-ocp/controller_projects_container_groups.yml @@ -0,0 +1,14 @@ +--- +controller_projects: + - name: "{{ orgs }} Container_Group" + description: "Project to run Container_Groups example" + organization: "{{ orgs }}" + scm_type: git + scm_url: "git@gitlab.automationiberia.com:aap-demo/readonly-playbooks.git" + scm_credential: "{{ orgs }} {{ env }} Gitlab Credential" + scm_clean: false + scm_delete_on_update: false + scm_update_on_launch: false + scm_update_cache_timeout: 86400 + allow_override: true +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/controller_projects.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/controller_projects.yml new file mode 100644 index 00000000..ac64afac --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/controller_projects.yml @@ -0,0 +1,3 @@ +--- +controller_projects: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/inventories/controller_projects_inventory_sourcea_dev.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/inventories/controller_projects_inventory_sourcea_dev.yml new file mode 100644 index 00000000..4cd6985d --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/inventories/controller_projects_inventory_sourcea_dev.yml @@ -0,0 +1,16 @@ +--- +controller_projects: + - name: "{{ orgs }} InventorySource SourceA dev" + description: "InventorySource SourceA dev from XLSX" + organization: "{{ orgs }}" + scm_type: git + scm_branch: "sourcea-dev" + scm_url: "git@gitlab.automationiberia.com:aap-demo/inventario_ansible_xlsx.git" + scm_credential: "{{ orgs }} {{ env }} Gitlab Credential" + scm_clean: false + scm_delete_on_update: false + scm_update_on_launch: false + scm_update_cache_timeout: 86400 + allow_override: true + +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/inventories/controller_projects_inventory_sourcea_prod.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/inventories/controller_projects_inventory_sourcea_prod.yml new file mode 100644 index 00000000..448c7681 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/inventories/controller_projects_inventory_sourcea_prod.yml @@ -0,0 +1,16 @@ +--- +controller_projects: + - name: "{{ orgs }} InventorySource SourceA prod" + description: "InventorySource SourceA prod from XLSX" + organization: "{{ orgs }}" + scm_type: git + scm_branch: "sourcea-prod" + scm_url: "git@gitlab.automationiberia.com:aap-demo/inventario_ansible_xlsx.git" + scm_credential: "{{ orgs }} {{ env }} Gitlab Credential" + scm_clean: false + scm_delete_on_update: false + scm_update_on_launch: false + scm_update_cache_timeout: 86400 + allow_override: true + +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/inventories/controller_projects_inventory_sourceb_dev.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/inventories/controller_projects_inventory_sourceb_dev.yml new file mode 100644 index 00000000..2591007b --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/inventories/controller_projects_inventory_sourceb_dev.yml @@ -0,0 +1,16 @@ +--- +controller_projects: + - name: "{{ orgs }} InventorySource SourceB dev" + description: "InventorySource SourceB dev from XLSX" + organization: "{{ orgs }}" + scm_type: git + scm_branch: "sourceb-dev" + scm_url: "git@gitlab.automationiberia.com:aap-demo/inventario_ansible_xlsx.git" + scm_credential: "{{ orgs }} {{ env }} Gitlab Credential" + scm_clean: false + scm_delete_on_update: false + scm_update_on_launch: false + scm_update_cache_timeout: 86400 + allow_override: true + +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/inventories/controller_projects_inventory_sourceb_prod.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/inventories/controller_projects_inventory_sourceb_prod.yml new file mode 100644 index 00000000..be8bd29f --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_projects.d/inventories/controller_projects_inventory_sourceb_prod.yml @@ -0,0 +1,16 @@ +--- +controller_projects: + - name: "{{ orgs }} InventorySource SourceB prod" + description: "InventorySource SourceB prod from XLSX" + organization: "{{ orgs }}" + scm_type: git + scm_branch: "sourceb-prod" + scm_url: "git@gitlab.automationiberia.com:aap-demo/inventario_ansible_xlsx.git" + scm_credential: "{{ orgs }} {{ env }} Gitlab Credential" + scm_clean: false + scm_delete_on_update: false + scm_update_on_launch: false + scm_update_cache_timeout: 86400 + allow_override: true + +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_cmdb_approvals.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_cmdb_approvals.yml new file mode 100644 index 00000000..5295dee6 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_cmdb_approvals.yml @@ -0,0 +1,7 @@ +--- +controller_roles: + - workflows: + - "{{ orgs }} WF_INVENTORY_SOURCE_UPDATE" + team: "ldap-users-cmdb" + role: approval +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_inventories.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_inventories.yml new file mode 100644 index 00000000..a4ef3c08 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_inventories.yml @@ -0,0 +1,48 @@ +--- +controller_roles: + - inventory: InventaryExcel + user: userorg1 + role: read + + - team: "ldap-org01-users" + inventories: + - "SmartInventory CPD BCN Org1 dev" + - "SmartInventory CPD MAD Org1 dev" + role: use + + - team: "ldap-org01-devs" + inventories: + - "SmartInventory CPD BCN Org1 dev" + - "SmartInventory CPD MAD Org1 dev" + role: use + + - team: "ldap-org01-admins" + inventories: + - "{{ orgs }} Localhost" + - "SmartInventory CPD BCN Org1 prod" + - "SmartInventory CPD MAD Org1 prod" + - "SmartInventory CPD BCN Org1 dev" + - "SmartInventory CPD MAD Org1 dev" + role: use + + - team: "ldap-org02-users" + inventories: + - "SmartInventory CPD BCN Org2 dev" + - "SmartInventory CPD MAD Org2 dev" + role: use + + - team: "ldap-org02-devs" + inventories: + - "SmartInventory CPD BCN Org2 dev" + - "SmartInventory CPD MAD Org2 dev" + role: use + + - team: "ldap-org02-admins" + inventories: + - "{{ orgs }} Localhost" + - "SmartInventory CPD BCN Org2 prod" + - "SmartInventory CPD MAD Org2 prod" + - "SmartInventory CPD BCN Org2 dev" + - "SmartInventory CPD MAD Org2 dev" + role: use +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_inventory_wf_update.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_inventory_wf_update.yml new file mode 100644 index 00000000..eeeb04cd --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_inventory_wf_update.yml @@ -0,0 +1,7 @@ +--- +controller_roles: + - workflows: + - "{{ orgs }} WF_INVENTORY_SOURCE_UPDATE" + team: "ldap-org01-users" + role: execute +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_teams.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_teams.yml new file mode 100644 index 00000000..086b7d48 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_teams.yml @@ -0,0 +1,8 @@ +--- +controller_roles: + - team: "Organization1 admins-team" + role: admin + + - team: "Organization2 admins-team" + role: admin +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_users.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_users.yml new file mode 100644 index 00000000..abce8c6e --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/app-example/controller_roles_users.yml @@ -0,0 +1,50 @@ +--- +controller_roles: + - user: "adminorg1" + organizations: + - "Organization1" + role: member + + - user: "adminorg1" + organizations: + - "Organization1" + role: member + target_teams: + - "Organization1 admins-team" + + - user: "adminorg2" + organizations: + - "Organization2" + role: member + + - user: "adminorg2" + organizations: + - "Organization2" + role: admin + target_teams: + - "Organization2 admins-team" + + - user: "userorg1" + organizations: + - "Organization1" + role: member + + - user: "userorg1" + organizations: + - "Organization1" + role: member + target_teams: + - "Organization1 users-team" + + - user: "userorg2" + organizations: + - "Organization2" + role: member + + - user: "userorg2" + organizations: + - "Organization2" + role: member + target_teams: + - "Organization2 users-team" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/controller_roles.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/controller_roles.yml new file mode 100644 index 00000000..c27de4fb --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_roles.d/controller_roles.yml @@ -0,0 +1,4 @@ +--- +## available roles: admin_role, execute_role, project_admin_role, inventory_admin_role, credential_admin_role, workflow_admin_role, notification_admin_role, job_template_admin_role, execution_environment_admin_role, auditor_role, member_role, read_role, approval_role +controller_roles: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_schedules.d/app-casc/controller_schedules_casc.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_schedules.d/app-casc/controller_schedules_casc.yml new file mode 100644 index 00000000..64499c99 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_schedules.d/app-casc/controller_schedules_casc.yml @@ -0,0 +1,30 @@ +--- +controller_schedules: + - name: "{{ orgs }} CasC_Objects_Cleanup" + description: CasC_Ojbects_Cleanup + unified_job_template: "{{ orgs }} CasC_JobTemplates_AAP_Desired_State" + rrule: DTSTART;TZID=Europe/Madrid:20220127T163000 RRULE:INTERVAL=1;FREQ=DAILY + job_tags: desired_state + enabled: false + extra_data: + ansible_python_interpreter: /usr/bin/python3 + ansible_async_dir: /home/runner/.ansible_async/ + env: "{{ env }}" + dir_orgs_vars: orgs_vars + orgs: "{{ orgs }}" + organization: "{{ orgs }}" + + - name: "{{ orgs }} CasC_Objects_Creation" + description: CasC_Ojbects_Cleanup + unified_job_template: "{{ orgs }} CasC_JobTemplates_AAP_CI_Config_Controller" + rrule: DTSTART;TZID=Europe/Madrid:20220127T000000 RRULE:INTERVAL=1;FREQ=DAILY + enabled: false + extra_data: + ansible_python_interpreter: /usr/bin/python3 + ansible_async_dir: /home/runner/.ansible_async/ + env: "{{ env }}" + dir_orgs_vars: orgs_vars + orgs: "{{ orgs }}" + organization: "{{ orgs }}" + +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_schedules.d/app-example/controller_schedules_example.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_schedules.d/app-example/controller_schedules_example.yml new file mode 100644 index 00000000..4845926b --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_schedules.d/app-example/controller_schedules_example.yml @@ -0,0 +1,3 @@ +--- +controller_schedules: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_schedules.d/controller_schedules.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_schedules.d/controller_schedules.yml new file mode 100644 index 00000000..4845926b --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_schedules.d/controller_schedules.yml @@ -0,0 +1,3 @@ +--- +controller_schedules: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_teams.d/app-demo/controller_teams_org1.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_teams.d/app-demo/controller_teams_org1.yml new file mode 100644 index 00000000..0e5548b1 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_teams.d/app-demo/controller_teams_org1.yml @@ -0,0 +1,10 @@ +--- +controller_teams: + - name: "Organization1 admins-team" + description: "Team for Admin Organization1 Org" + organization: "Organization1" + + - name: "Organization1 users-team" + description: "Team for Normal Organization1 Org" + organization: "Organization1" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_teams.d/app-demo/controller_teams_org2.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_teams.d/app-demo/controller_teams_org2.yml new file mode 100644 index 00000000..5f268642 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_teams.d/app-demo/controller_teams_org2.yml @@ -0,0 +1,10 @@ +--- +controller_teams: + - name: "Organization2 admins-team" + description: "Team for Admin Organization2 Org" + organization: "Organization2" + + - name: "Organization2 users-team" + description: "Team for Normal Organization2 Org" + organization: "Organization2" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_teams.d/controller_teams.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_teams.d/controller_teams.yml new file mode 100644 index 00000000..8710e6f7 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_teams.d/controller_teams.yml @@ -0,0 +1,10 @@ +--- +controller_teams: + - name: "{{ orgs }} {{ orgs }}-team" + description: "Team for {{ orgs }} Org" + organization: "{{ orgs }}" + + - name: "{{ orgs }} test-group" + description: "test-group" + organization: "{{ orgs }}" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_workflow_job_templates.d/app-casc/controller_workflow_job_templates_casc.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_workflow_job_templates.d/app-casc/controller_workflow_job_templates_casc.yml new file mode 100644 index 00000000..461f60d9 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_workflow_job_templates.d/app-casc/controller_workflow_job_templates_casc.yml @@ -0,0 +1,32 @@ +--- +controller_workflows: + - name: "{{ orgs }} CasC_AAP_Workflow" + state: present + description: "workflow for CasC on AAP" + survey_enabled: false + ask_variables_on_launch: true + allow_simultaneous: true + scm_branch: "{{ env }}" + webhook_service: "gitlab" + organization: "{{ orgs }}" + simplified_workflow_nodes: + - identifier: "LAUNCH_CI_{{ orgs }}" + workflow_job_template: "{{ orgs }} CasC_AAP_Workflow" + unified_job_template: "{{ orgs }} CasC_JobTemplates_AAP_CI_Webhook" + job_type: run + organization: "{{ orgs }}" + workflow: "{{ orgs }} CasC_AAP_Workflow" + + - identifier: "PROJECT_SYNC_{{ orgs }}" + workflow_job_template: "{{ orgs }} CasC_AAP_Workflow" + unified_job_template: "{{ orgs }} CasC_Data" + organization: "{{ orgs }}" + workflow: "{{ orgs }} CasC_AAP_Workflow" + success_nodes: + - "LAUNCH_CI_{{ orgs }}" + notification_templates_started: [] + notification_templates_success: [] + notification_templates_error: [] + notification_templates_approvals: [] + survey_spec: {} +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_workflow_job_templates.d/app-examples/controller_workflow_job_templates_InventoryUpdate.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_workflow_job_templates.d/app-examples/controller_workflow_job_templates_InventoryUpdate.yml new file mode 100644 index 00000000..d996c188 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_workflow_job_templates.d/app-examples/controller_workflow_job_templates_InventoryUpdate.yml @@ -0,0 +1,72 @@ +--- +controller_workflows: + - name: "{{ orgs }} WF_INVENTORY_SOURCE_UPDATE" + state: present + description: "workflow for update the sources of the inventory" + survey_enabled: false + ask_variables_on_launch: true + allow_simultaneous: true + scm_branch: "{{ env }}" + organization: "{{ orgs }}" + simplified_workflow_nodes: + - identifier: APPROVAL_WF_INV + workflow_job_template: "{{ orgs }} WF_INVENTORY_SOURCE_UPDATE" + organization: "{{ orgs }}" + success_nodes: + - SYNC_SRC_A_DEV + - SYNC_SRC_B_DEV + - SYNC_SRC_A_PROD + - SYNC_SRC_B_PROD + approval_node: + description: "First step to update the Inventory Sources, Approval from CMDB Admins" + name: APPROVAL_WF_INVENTORY_UPDATE + timeout: 3600 + + - identifier: SYNC_SRC_A_DEV + workflow_job_template: "{{ orgs }} WF_INVENTORY_SOURCE_UPDATE" + unified_job_template: "{{ orgs }} InventorySource SourceA dev" + organization: "{{ orgs }}" + success_nodes: + - INVENTORY_SOURCE_A_DEV + + - identifier: SYNC_SRC_B_DEV + workflow_job_template: "{{ orgs }} WF_INVENTORY_SOURCE_UPDATE" + unified_job_template: "{{ orgs }} InventorySource SourceB dev" + organization: "{{ orgs }}" + success_nodes: + - INVENTORY_SOURCE_B_DEV + + - identifier: SYNC_SRC_A_PROD + workflow_job_template: "{{ orgs }} WF_INVENTORY_SOURCE_UPDATE" + unified_job_template: "{{ orgs }} InventorySource SourceA prod" + organization: "{{ orgs }}" + success_nodes: + - INVENTORY_SOURCE_A_PROD + + - identifier: SYNC_SRC_B_PROD + workflow_job_template: "{{ orgs }} WF_INVENTORY_SOURCE_UPDATE" + unified_job_template: "{{ orgs }} InventorySource SourceB prod" + organization: "{{ orgs }}" + success_nodes: + - INVENTORY_SOURCE_B_PROD + + - identifier: INVENTORY_SOURCE_A_DEV + workflow_job_template: "{{ orgs }} WF_INVENTORY_SOURCE_UPDATE" + unified_job_template: "Inventory Source A Dev" + organization: "{{ orgs }}" + + - identifier: INVENTORY_SOURCE_B_DEV + workflow_job_template: "{{ orgs }} WF_INVENTORY_SOURCE_UPDATE" + unified_job_template: "Inventory Source B Dev" + organization: "{{ orgs }}" + + - identifier: INVENTORY_SOURCE_A_PROD + workflow_job_template: "{{ orgs }} WF_INVENTORY_SOURCE_UPDATE" + unified_job_template: "Inventory Source A Prod" + organization: "{{ orgs }}" + + - identifier: INVENTORY_SOURCE_B_PROD + workflow_job_template: "{{ orgs }} WF_INVENTORY_SOURCE_UPDATE" + unified_job_template: "Inventory Source B Prod" + organization: "{{ orgs }}" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_workflow_job_templates.d/controller_workflow_job_templates.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_workflow_job_templates.d/controller_workflow_job_templates.yml new file mode 100644 index 00000000..e8561741 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/common/controller_workflow_job_templates.d/controller_workflow_job_templates.yml @@ -0,0 +1,3 @@ +--- +controller_workflows: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_aap.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_aap.yml new file mode 100644 index 00000000..f0a92b14 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_aap.yml @@ -0,0 +1,12 @@ +--- +controller_credentials: + - name: "AAP Credentials Example" + description: "Ansible Automation Platform Credentials Example" + credential_type: "Red Hat Ansible Automation Platform" + organization: "ExampleOrg" + inputs: + host: "controller.lab.example.com" + username: "controller-user" + password: "controller-password" + verify_ssl: false +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_galaxy.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_galaxy.yml new file mode 100644 index 00000000..6774f806 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_galaxy.yml @@ -0,0 +1,26 @@ +--- +controller_credentials: + - name: "Automation Hub Community Repository Example" + description: "Automation Hub Community Repository Example" + credential_type: "Ansible Galaxy/Automation Hub API Token" + organization: "ExampleOrg" + inputs: + url: "https://automationhub.lab.example.com/api/galaxy/content/community/" + token: "AddToken" + + - name: "Automation Hub Published Repository Example" + description: "Automation Hub Published Repository Example" + credential_type: "Ansible Galaxy/Automation Hub API Token" + organization: "ExampleOrg" + inputs: + url: "https://automationhub.lab.example.com/api/galaxy/content/published/" + token: "AddToken" + + - name: "Automation Hub RH Certified Repository Example" + description: "" + credential_type: "Ansible Galaxy/Automation Hub API Token" + organization: "ExampleOrg" + inputs: + url: "https://automationhub.lab.example.com/api/galaxy/content/rh-certified/" + token: "AddToken" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_machine.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_machine.yml new file mode 100644 index 00000000..97159494 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_machine.yml @@ -0,0 +1,10 @@ +--- +controller_credentials: + - name: "Machine Credentials Example" + description: "Machine Credentials Example" + credential_type: "Machine" + organization: "ExampleOrg" + inputs: + username: "user-ansible" + password: "password" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_ocp.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_ocp.yml new file mode 100644 index 00000000..05bc7ed7 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_ocp.yml @@ -0,0 +1,11 @@ +--- +controller_credentials: + - name: "Credentials OCP Example" + description: "OCP SA to run Container Groups Example" + credential_type: "OpenShift or Kubernetes API Bearer Token" + organization: "ExampleOrg" + inputs: + host: "https://api.cluster.lab.example.com:6443" + verify_ssl: false + bearer_token: "Addbearer_token" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_registry.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_registry.yml new file mode 100644 index 00000000..2af2e6a6 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_registry.yml @@ -0,0 +1,12 @@ +--- +controller_credentials: + - name: "Automation Private Hub Container Registry Example" + description: "Credential to connect to Container Registry at AtomationHub Private Example" + credential_type: "Container Registry" + organization: "ExampleOrg" + inputs: + username: "registry-user" + password: "password" + host: automationhub.lab.example.com + verify_ssl: false +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_scm.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_scm.yml new file mode 100644 index 00000000..0cdfe720 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_scm.yml @@ -0,0 +1,19 @@ +--- +controller_credentials: + - name: "Gitlab Credential Example" + description: "Gitlab Credential Example" + credential_type: "Source Control" + organization: "ExampleOrg" + inputs: + username: 'scm-user' + ssh_key_data: | + -----BEGIN RSA PRIVATE KEY----- + MIIBOgIBAAJBAKj34GkxFhD90vcNLYLInFEX6Ppy1tPf9Cnzj4p4WGeKLs1Pt8Qu + KUpRKfFLfRYC9AIKjbJTWit+CqvjWYzvQwECAwEAAQJAIJLixBy2qpFoS4DSmoEm + o3qGy0t6z09AIJtH+5OeRV1be+N4cDYJKffGzDa88vQENZiRm0GRq6a+HPGQMd2k + TQIhAKMSvzIBnni7ot/OSie2TmJLY4SwTQAevXysE2RbFDYdAiEBCUEaRQnMnbp7 + 9mxDXDf6AU0cN/RPBjb9qSHDcWZHGzUCIG2Es59z8ugGrDY+pxLQnwfotadxd+Uy + v/Ow5T0q5gIJAiEAyS4RaI9YG8EWx/2w0T67ZUVAw8eOMB6BIUg0Xcu+3okCIBOs + /5OiPgoTdSy7bcF9IGpSE8ZgGKzgYQVZeN97YE00 + -----END RSA PRIVATE KEY----- +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_vault.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_vault.yml new file mode 100644 index 00000000..e74f3e1f --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_credentials.d/app-examples/controller_credentials_vault.yml @@ -0,0 +1,9 @@ +--- +controller_credentials: + - name: "Vault Credentials Example" + description: "Vault Credentials Example" + credential_type: "Vault" + organization: "ExampleOrg" + inputs: + vault_password: "password" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_execution_environments.d/app-casc/controller_execution_environments_ee-casc.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_execution_environments.d/app-casc/controller_execution_environments_ee-casc.yml new file mode 100644 index 00000000..b98fae31 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_execution_environments.d/app-casc/controller_execution_environments_ee-casc.yml @@ -0,0 +1,7 @@ +--- +controller_execution_environments: + - name: "ee-casc" + image: automationhub.automationiberia.com/ee-casc:latest + pull: always + credential: "{{ orgs }} {{ env }} Automation Private Hub Container Registry" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_execution_environments.d/app-examples/controller_execution_environments_ee-xlsx.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_execution_environments.d/app-examples/controller_execution_environments_ee-xlsx.yml new file mode 100644 index 00000000..de9e3526 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_execution_environments.d/app-examples/controller_execution_environments_ee-xlsx.yml @@ -0,0 +1,12 @@ +--- +controller_execution_environments: + - name: "ee-xlsx" + image: automationhub.automationiberia.com/ee-xlsx:latest + pull: always + credential: "{{ orgs }} {{ env }} Automation Private Hub Container Registry" + + - name: "test-ee-xlsx" + image: automationhub.automationiberia.com/test-ee-xlsx:0.2 + pull: always + credential: "{{ orgs }} {{ env }} Automation Private Hub Container Registry" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_execution_environments.d/controller_execution_environments.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_execution_environments.d/controller_execution_environments.yml new file mode 100644 index 00000000..28041d44 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_execution_environments.d/controller_execution_environments.yml @@ -0,0 +1,3 @@ +--- +controller_execution_environments: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_hosts.d/app-casc/controller_hosts_localhost.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_hosts.d/app-casc/controller_hosts_localhost.yml new file mode 100644 index 00000000..4b9e5a99 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_hosts.d/app-casc/controller_hosts_localhost.yml @@ -0,0 +1,6 @@ +--- +controller_hosts: + - name: localhost + description: localhost + inventory: "{{ orgs }} Localhost" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_hosts.d/controller_hosts.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_hosts.d/controller_hosts.yml new file mode 100644 index 00000000..5fd4d814 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_hosts.d/controller_hosts.yml @@ -0,0 +1,3 @@ +--- +controller_hosts: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourcea_dev.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourcea_dev.yml new file mode 100644 index 00000000..3ac12330 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourcea_dev.yml @@ -0,0 +1,12 @@ +--- +controller_inventory_sources: + - name: "Inventory Source A Dev" + description: "Source Inventory from Excel file SourceA dev" + source: scm + source_project: "{{ orgs }} InventorySource SourceA dev" + execution_environment: ee-xlsx + source_path: "xlsx_inventory.py" + inventory: "InventaryExcel" + update_on_launch: false + overwrite: true +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourcea_prod.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourcea_prod.yml new file mode 100644 index 00000000..dd3242be --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourcea_prod.yml @@ -0,0 +1,12 @@ +--- +controller_inventory_sources: + - name: "Inventory Source A Prod" + description: "Source Inventory from Excel file SourceA prod" + source: scm + source_project: "{{ orgs }} InventorySource SourceA prod" + execution_environment: ee-xlsx + source_path: "xlsx_inventory.py" + inventory: "InventaryExcel" + update_on_launch: false + overwrite: true +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourceb_dev.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourceb_dev.yml new file mode 100644 index 00000000..2024f92f --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourceb_dev.yml @@ -0,0 +1,12 @@ +--- +controller_inventory_sources: + - name: "Inventory Source B Dev" + description: "Source Inventory from Excel file SourceB dev" + source: scm + source_project: "{{ orgs }} InventorySource SourceB dev" + execution_environment: ee-xlsx + source_path: "xlsx_inventory.py" + inventory: "InventaryExcel" + update_on_launch: false + overwrite: true +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourceb_prod.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourceb_prod.yml new file mode 100644 index 00000000..67ad9c1d --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourceb_prod.yml @@ -0,0 +1,12 @@ +--- +controller_inventory_sources: + - name: "Inventory Source B Prod" + description: "Source Inventory from Excel file SourceB prod" + source: scm + source_project: "{{ orgs }} InventorySource SourceB prod" + execution_environment: ee-xlsx + source_path: "xlsx_inventory.py" + inventory: "InventaryExcel" + update_on_launch: false + overwrite: true +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/controller_inventory_sources.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/controller_inventory_sources.yml new file mode 100644 index 00000000..cd9fc77b --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_inventory_sources.d/controller_inventory_sources.yml @@ -0,0 +1,3 @@ +--- +controller_inventory_sources: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/app-examples/controller_settings_jobs.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/app-examples/controller_settings_jobs.yml new file mode 100644 index 00000000..43cf1a8a --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/app-examples/controller_settings_jobs.yml @@ -0,0 +1,13 @@ +--- +controller_settings: + # - name: AWX_ISOLATION_SHOW_PATHS + # value: "['/tmp', '/mnt/backup']" + - name: DEFAULT_PROJECT_UPDATE_TIMEOUT + value: 0 + - name: DEFAULT_INVENTORY_UPDATE_TIMEOUT + value: 0 + - name: DEFAULT_JOB_TIMEOUT + value: 0 + - name: MAX_FORKS + value: 200 +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/app-examples/controller_settings_ldap.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/app-examples/controller_settings_ldap.yml new file mode 100644 index 00000000..9d9f4c76 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/app-examples/controller_settings_ldap.yml @@ -0,0 +1,113 @@ +--- +controller_settings: + - name: AUTH_LDAP_SERVER_URI + value: "ldap://idm.automationiberia.com" + - name: AUTH_LDAP_BIND_DN + value: "{{ vault_ldap_bind_dn | default('uid=controller-binddn,cn=sysaccounts,cn=etc,dc=automationiberia,dc=com') }}" + - name: AUTH_LDAP_BIND_PASSWORD + value: "{{ vault_ldap_bind_password | default('password') }}" + - name: AUTH_LDAP_START_TLS + value: false + - name: AUTH_LDAP_USER_DN_TEMPLATE + value: "" + - name: AUTH_LDAP_CONNECTION_OPTIONS + value: + OPT_REFERRALS: 0 + OPT_NETWORK_TIMEOUT: 30 + - name: AUTH_LDAP_USER_SEARCH + value: ["cn=users,cn=accounts,dc=bcnconsulting,dc=com", "SCOPE_SUBTREE", "(uid=%(user)s)"] + - name: AUTH_LDAP_USER_DN_TEMPLATE + value: "" + - name: AUTH_LDAP_USER_ATTR_MAP + value: {"first_name": "givenName", "last_name": "sn", "email": "mail"} + - name: AUTH_LDAP_GROUP_SEARCH + value: ["cn=groups,cn=accounts,dc=bcnconsulting,dc=com", "SCOPE_SUBTREE", "(objectClass=posixgroup)"] + - name: AUTH_LDAP_GROUP_TYPE + value: "MemberDNGroupType" + - name: AUTH_LDAP_GROUP_TYPE_PARAMS + value: {"name_attr": "cn", "member_attr": "member"} + - name: AUTH_LDAP_REQUIRE_GROUP + value: "" + - name: AUTH_LDAP_DENY_GROUP + value: "" + - name: AUTH_LDAP_USER_FLAGS_BY_GROUP + value: {"is_superuser": ["cn=controller-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com"], "is_system_auditor": ["cn=team-ldap-auditor,cn=groups,cn=accounts,dc=bcnconsulting,dc=com"]} + - name: AUTH_LDAP_ORGANIZATION_MAP + value: { + "{{ orgs }}": { + "admins": "cn=controller-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove_users": true, + "remove_admins": true + }, + "Organization1": { + "admins": [ + "cn=team-ldap-org01-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com" + ], + "users": [ + "cn=team-ldap-org01-users,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "cn=team-ldap-org01-devs,cn=groups,cn=accounts,dc=bcnconsulting,dc=com" + ], + "remove_users": true, + "remove_admins": true + }, + "Organization2": { + "admins": [ + "cn=team-ldap-org02-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com" + ], + "users": [ + "cn=team-ldap-org02-users,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "cn=team-ldap-org02-devs,cn=groups,cn=accounts,dc=bcnconsulting,dc=com" + ], + "remove_users": true, + "remove_admins": true + } + } + - name: AUTH_LDAP_TEAM_MAP + value: { + "ldap-controller-admins": { + "organization": "{{ orgs }}", + "users": "cn=team-ldap-controller-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-users-cmdb": { + "organization": "{{ orgs }}", + "users": "cn=team-ldap-cmdb-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-users-crossteam": { + "organization": "CrossTeamOrg", + "users": "cn=team-ldap-users-crossteam,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-org01-admins": { + "organization": "Organization1", + "users": "cn=team-ldap-org01-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-org01-users": { + "organization": "Organization1", + "users": "cn=team-ldap-org01-users,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-org01-devs": { + "organization": "Organization1", + "users": "cn=team-ldap-org01-devs,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-org02-admins": { + "organization": "Organization2", + "users": "cn=team-ldap-org02-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-org02-users": { + "organization": "Organization2", + "users": "cn=team-ldap-org02-users,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-org02-devs": { + "organization": "Organization2", + "users": "cn=team-ldap-org02-devs,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + } + } +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/app-examples/controller_settings_system.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/app-examples/controller_settings_system.yml new file mode 100644 index 00000000..5f9ae238 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/app-examples/controller_settings_system.yml @@ -0,0 +1,18 @@ +--- +controller_settings: + # - name: ACTIVITY_STREAM_ENABLED + # value: true + # - name: ACTIVITY_STREAM_ENABLED_FOR_INVENTORY_SYNC + # value: false + # - name: SESSION_COOKIE_AGE + # value: 1800 + # - name: SESSIONS_PER_USER + # value: 10 + # - name: MANAGE_ORGANIZATION_AUTH + # value: true + # https://access.redhat.com/solutions/6613291 - External users are not able to create token on Ansible Tower. + - name: ALLOW_OAUTH2_FOR_EXTERNAL_USERS + value: true + - name: ORG_ADMINS_CAN_SEE_ALL_USERS + value: false +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/app-examples/controller_settings_user_interface.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/app-examples/controller_settings_user_interface.yml new file mode 100644 index 00000000..f465d180 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/app-examples/controller_settings_user_interface.yml @@ -0,0 +1,5 @@ +--- +controller_settings: + - name: CUSTOM_LOGIN_INFO + value: "This is a custom message provided by Customer - Consulting Barcelona" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/controller_settings.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/controller_settings.yml new file mode 100644 index 00000000..7e6d3c65 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_settings.d/controller_settings.yml @@ -0,0 +1,4 @@ +--- +# tower-manage print_settings +controller_settings: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_users.d/app-demo/controller_user_accounts_org1.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_users.d/app-demo/controller_user_accounts_org1.yml new file mode 100644 index 00000000..fb71e061 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_users.d/app-demo/controller_user_accounts_org1.yml @@ -0,0 +1,15 @@ +--- +controller_user_accounts: + - username: "adminorg1" + password: "password" + email: "adminorg1@example.com" + firstname: "adminorg1" + lastname: "adminorg1" + is_auditor: false + is_superuser: false + + - username: "userorg1" + password: "password" + email: "userorg1@example.com" + is_superuser: false +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_users.d/app-demo/controller_user_accounts_org2.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_users.d/app-demo/controller_user_accounts_org2.yml new file mode 100644 index 00000000..688dfca1 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_users.d/app-demo/controller_user_accounts_org2.yml @@ -0,0 +1,15 @@ +--- +controller_user_accounts: + - username: "adminorg2" + password: "password" + email: "adminorg2@example.com" + firstname: "adminorg2" + lastname: "adminorg2" + is_auditor: false + is_superuser: false + + - username: "userorg2" + password: "password" + email: "userorg2@example.com" + is_superuser: false +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_users.d/controller_user_accounts.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_users.d/controller_user_accounts.yml new file mode 100644 index 00000000..06dd02b0 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/dev/controller_users.d/controller_user_accounts.yml @@ -0,0 +1,11 @@ +--- +controller_user_accounts: + - username: "admin" + password: "password" + email: "admin@example.com" + firstname: "admin" + lastname: "admin" + is_auditor: false + is_superuser: true + update_secrets: false +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_aap.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_aap.yml new file mode 100644 index 00000000..f0a92b14 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_aap.yml @@ -0,0 +1,12 @@ +--- +controller_credentials: + - name: "AAP Credentials Example" + description: "Ansible Automation Platform Credentials Example" + credential_type: "Red Hat Ansible Automation Platform" + organization: "ExampleOrg" + inputs: + host: "controller.lab.example.com" + username: "controller-user" + password: "controller-password" + verify_ssl: false +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_galaxy.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_galaxy.yml new file mode 100644 index 00000000..6774f806 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_galaxy.yml @@ -0,0 +1,26 @@ +--- +controller_credentials: + - name: "Automation Hub Community Repository Example" + description: "Automation Hub Community Repository Example" + credential_type: "Ansible Galaxy/Automation Hub API Token" + organization: "ExampleOrg" + inputs: + url: "https://automationhub.lab.example.com/api/galaxy/content/community/" + token: "AddToken" + + - name: "Automation Hub Published Repository Example" + description: "Automation Hub Published Repository Example" + credential_type: "Ansible Galaxy/Automation Hub API Token" + organization: "ExampleOrg" + inputs: + url: "https://automationhub.lab.example.com/api/galaxy/content/published/" + token: "AddToken" + + - name: "Automation Hub RH Certified Repository Example" + description: "" + credential_type: "Ansible Galaxy/Automation Hub API Token" + organization: "ExampleOrg" + inputs: + url: "https://automationhub.lab.example.com/api/galaxy/content/rh-certified/" + token: "AddToken" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_machine.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_machine.yml new file mode 100644 index 00000000..97159494 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_machine.yml @@ -0,0 +1,10 @@ +--- +controller_credentials: + - name: "Machine Credentials Example" + description: "Machine Credentials Example" + credential_type: "Machine" + organization: "ExampleOrg" + inputs: + username: "user-ansible" + password: "password" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_ocp.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_ocp.yml new file mode 100644 index 00000000..05bc7ed7 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_ocp.yml @@ -0,0 +1,11 @@ +--- +controller_credentials: + - name: "Credentials OCP Example" + description: "OCP SA to run Container Groups Example" + credential_type: "OpenShift or Kubernetes API Bearer Token" + organization: "ExampleOrg" + inputs: + host: "https://api.cluster.lab.example.com:6443" + verify_ssl: false + bearer_token: "Addbearer_token" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_registry.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_registry.yml new file mode 100644 index 00000000..2af2e6a6 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_registry.yml @@ -0,0 +1,12 @@ +--- +controller_credentials: + - name: "Automation Private Hub Container Registry Example" + description: "Credential to connect to Container Registry at AtomationHub Private Example" + credential_type: "Container Registry" + organization: "ExampleOrg" + inputs: + username: "registry-user" + password: "password" + host: automationhub.lab.example.com + verify_ssl: false +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_scm.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_scm.yml new file mode 100644 index 00000000..0cdfe720 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_scm.yml @@ -0,0 +1,19 @@ +--- +controller_credentials: + - name: "Gitlab Credential Example" + description: "Gitlab Credential Example" + credential_type: "Source Control" + organization: "ExampleOrg" + inputs: + username: 'scm-user' + ssh_key_data: | + -----BEGIN RSA PRIVATE KEY----- + MIIBOgIBAAJBAKj34GkxFhD90vcNLYLInFEX6Ppy1tPf9Cnzj4p4WGeKLs1Pt8Qu + KUpRKfFLfRYC9AIKjbJTWit+CqvjWYzvQwECAwEAAQJAIJLixBy2qpFoS4DSmoEm + o3qGy0t6z09AIJtH+5OeRV1be+N4cDYJKffGzDa88vQENZiRm0GRq6a+HPGQMd2k + TQIhAKMSvzIBnni7ot/OSie2TmJLY4SwTQAevXysE2RbFDYdAiEBCUEaRQnMnbp7 + 9mxDXDf6AU0cN/RPBjb9qSHDcWZHGzUCIG2Es59z8ugGrDY+pxLQnwfotadxd+Uy + v/Ow5T0q5gIJAiEAyS4RaI9YG8EWx/2w0T67ZUVAw8eOMB6BIUg0Xcu+3okCIBOs + /5OiPgoTdSy7bcF9IGpSE8ZgGKzgYQVZeN97YE00 + -----END RSA PRIVATE KEY----- +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_vault.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_vault.yml new file mode 100644 index 00000000..e74f3e1f --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_credentials.d/app-examples/controller_credentials_vault.yml @@ -0,0 +1,9 @@ +--- +controller_credentials: + - name: "Vault Credentials Example" + description: "Vault Credentials Example" + credential_type: "Vault" + organization: "ExampleOrg" + inputs: + vault_password: "password" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_execution_environments.d/app-casc/controller_execution_environments_ee-casc.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_execution_environments.d/app-casc/controller_execution_environments_ee-casc.yml new file mode 100644 index 00000000..b98fae31 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_execution_environments.d/app-casc/controller_execution_environments_ee-casc.yml @@ -0,0 +1,7 @@ +--- +controller_execution_environments: + - name: "ee-casc" + image: automationhub.automationiberia.com/ee-casc:latest + pull: always + credential: "{{ orgs }} {{ env }} Automation Private Hub Container Registry" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_execution_environments.d/app-examples/controller_execution_environments_ee-xlsx.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_execution_environments.d/app-examples/controller_execution_environments_ee-xlsx.yml new file mode 100644 index 00000000..de9e3526 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_execution_environments.d/app-examples/controller_execution_environments_ee-xlsx.yml @@ -0,0 +1,12 @@ +--- +controller_execution_environments: + - name: "ee-xlsx" + image: automationhub.automationiberia.com/ee-xlsx:latest + pull: always + credential: "{{ orgs }} {{ env }} Automation Private Hub Container Registry" + + - name: "test-ee-xlsx" + image: automationhub.automationiberia.com/test-ee-xlsx:0.2 + pull: always + credential: "{{ orgs }} {{ env }} Automation Private Hub Container Registry" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_execution_environments.d/controller_execution_environments.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_execution_environments.d/controller_execution_environments.yml new file mode 100644 index 00000000..28041d44 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_execution_environments.d/controller_execution_environments.yml @@ -0,0 +1,3 @@ +--- +controller_execution_environments: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_hosts.d/controller_hosts.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_hosts.d/controller_hosts.yml new file mode 100644 index 00000000..4b9e5a99 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_hosts.d/controller_hosts.yml @@ -0,0 +1,6 @@ +--- +controller_hosts: + - name: localhost + description: localhost + inventory: "{{ orgs }} Localhost" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourcea_dev.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourcea_dev.yml new file mode 100644 index 00000000..3ac12330 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourcea_dev.yml @@ -0,0 +1,12 @@ +--- +controller_inventory_sources: + - name: "Inventory Source A Dev" + description: "Source Inventory from Excel file SourceA dev" + source: scm + source_project: "{{ orgs }} InventorySource SourceA dev" + execution_environment: ee-xlsx + source_path: "xlsx_inventory.py" + inventory: "InventaryExcel" + update_on_launch: false + overwrite: true +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourcea_prod.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourcea_prod.yml new file mode 100644 index 00000000..dd3242be --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourcea_prod.yml @@ -0,0 +1,12 @@ +--- +controller_inventory_sources: + - name: "Inventory Source A Prod" + description: "Source Inventory from Excel file SourceA prod" + source: scm + source_project: "{{ orgs }} InventorySource SourceA prod" + execution_environment: ee-xlsx + source_path: "xlsx_inventory.py" + inventory: "InventaryExcel" + update_on_launch: false + overwrite: true +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourceb_dev.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourceb_dev.yml new file mode 100644 index 00000000..2024f92f --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourceb_dev.yml @@ -0,0 +1,12 @@ +--- +controller_inventory_sources: + - name: "Inventory Source B Dev" + description: "Source Inventory from Excel file SourceB dev" + source: scm + source_project: "{{ orgs }} InventorySource SourceB dev" + execution_environment: ee-xlsx + source_path: "xlsx_inventory.py" + inventory: "InventaryExcel" + update_on_launch: false + overwrite: true +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourceb_prod.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourceb_prod.yml new file mode 100644 index 00000000..67ad9c1d --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/app-examples/controller_inventory_sources_sourceb_prod.yml @@ -0,0 +1,12 @@ +--- +controller_inventory_sources: + - name: "Inventory Source B Prod" + description: "Source Inventory from Excel file SourceB prod" + source: scm + source_project: "{{ orgs }} InventorySource SourceB prod" + execution_environment: ee-xlsx + source_path: "xlsx_inventory.py" + inventory: "InventaryExcel" + update_on_launch: false + overwrite: true +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/controller_inventory_sources.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/controller_inventory_sources.yml new file mode 100644 index 00000000..cd9fc77b --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_inventory_sources.d/controller_inventory_sources.yml @@ -0,0 +1,3 @@ +--- +controller_inventory_sources: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/app-examples/controller_settings_jobs.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/app-examples/controller_settings_jobs.yml new file mode 100644 index 00000000..43cf1a8a --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/app-examples/controller_settings_jobs.yml @@ -0,0 +1,13 @@ +--- +controller_settings: + # - name: AWX_ISOLATION_SHOW_PATHS + # value: "['/tmp', '/mnt/backup']" + - name: DEFAULT_PROJECT_UPDATE_TIMEOUT + value: 0 + - name: DEFAULT_INVENTORY_UPDATE_TIMEOUT + value: 0 + - name: DEFAULT_JOB_TIMEOUT + value: 0 + - name: MAX_FORKS + value: 200 +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/app-examples/controller_settings_ldap.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/app-examples/controller_settings_ldap.yml new file mode 100644 index 00000000..b6d14c45 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/app-examples/controller_settings_ldap.yml @@ -0,0 +1,113 @@ +--- +controller_settings: + - name: AUTH_LDAP_SERVER_URI + value: "ldap://idm.automationiberia.com" + - name: AUTH_LDAP_BIND_DN + value: "{{ vault_ldap_bind_dn | default('uid=controller-binddn,cn=sysaccounts,cn=etc,dc=automationiberia,dc=com') }}" + - name: AUTH_LDAP_BIND_PASSWORD + value: "{{ vault_ldap_bind_password | default('password') }}" + - name: AUTH_LDAP_START_TLS + value: false + - name: AUTH_LDAP_USER_DN_TEMPLATE + value: "" + - name: AUTH_LDAP_CONNECTION_OPTIONS + value: + OPT_REFERRALS: 0 + OPT_NETWORK_TIMEOUT: 30 + - name: AUTH_LDAP_USER_SEARCH + value: ["cn=users,cn=accounts,dc=bcnconsulting,dc=com", "SCOPE_SUBTREE", "(uid=%(user)s)"] + - name: AUTH_LDAP_USER_DN_TEMPLATE + value: "" + - name: AUTH_LDAP_USER_ATTR_MAP + value: {"first_name": "givenName", "last_name": "sn", "email": "mail"} + - name: AUTH_LDAP_GROUP_SEARCH + value: ["cn=groups, cn=accounts, dc=bcnconsulting,dc=com", "SCOPE_SUBTREE", "(objectClass=posixgroup)"] + - name: AUTH_LDAP_GROUP_TYPE + value: "MemberDNGroupType" + - name: AUTH_LDAP_GROUP_TYPE_PARAMS + value: {"name_attr": "cn", "member_attr": "member"} + - name: AUTH_LDAP_REQUIRE_GROUP + value: "" + - name: AUTH_LDAP_DENY_GROUP + value: "" + - name: AUTH_LDAP_USER_FLAGS_BY_GROUP + value: {"is_superuser": ["cn=controller-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com"], "is_system_auditor": ["cn=team-ldap-auditor,cn=groups,cn=accounts,dc=bcnconsulting,dc=com"]} + - name: AUTH_LDAP_ORGANIZATION_MAP + value: { + "{{ orgs }}": { + "admins": "cn=controller-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove_users": true, + "remove_admins": true + }, + "Organization1": { + "admins": [ + "cn=team-ldap-org01-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com" + ], + "users": [ + "cn=team-ldap-org01-users,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "cn=team-ldap-org01-devs,cn=groups,cn=accounts,dc=bcnconsulting,dc=com" + ], + "remove_users": true, + "remove_admins": true + }, + "Organization2": { + "admins": [ + "cn=team-ldap-org02-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com" + ], + "users": [ + "cn=team-ldap-org02-users,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "cn=team-ldap-org02-devs,cn=groups,cn=accounts,dc=bcnconsulting,dc=com" + ], + "remove_users": true, + "remove_admins": true + } + } + - name: AUTH_LDAP_TEAM_MAP + value: { + "ldap-controller-admins": { + "organization": "{{ orgs }}", + "users": "cn=team-ldap-controller-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-users-cmdb": { + "organization": "{{ orgs }}", + "users": "cn=team-ldap-cmdb-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-users-crossteam": { + "organization": "CrossTeamOrg", + "users": "cn=team-ldap-users-crossteam,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-org01-admins": { + "organization": "Organization1", + "users": "cn=team-ldap-org01-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-org01-users": { + "organization": "Organization1", + "users": "cn=team-ldap-org01-users,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-org01-devs": { + "organization": "Organization1", + "users": "cn=team-ldap-org01-devs,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-org02-admins": { + "organization": "Organization2", + "users": "cn=team-ldap-org02-admins,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-org02-users": { + "organization": "Organization2", + "users": "cn=team-ldap-org02-users,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + }, + "ldap-org02-devs": { + "organization": "Organization2", + "users": "cn=team-ldap-org02-devs,cn=groups,cn=accounts,dc=bcnconsulting,dc=com", + "remove": true + } + } +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/app-examples/controller_settings_system.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/app-examples/controller_settings_system.yml new file mode 100644 index 00000000..5f9ae238 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/app-examples/controller_settings_system.yml @@ -0,0 +1,18 @@ +--- +controller_settings: + # - name: ACTIVITY_STREAM_ENABLED + # value: true + # - name: ACTIVITY_STREAM_ENABLED_FOR_INVENTORY_SYNC + # value: false + # - name: SESSION_COOKIE_AGE + # value: 1800 + # - name: SESSIONS_PER_USER + # value: 10 + # - name: MANAGE_ORGANIZATION_AUTH + # value: true + # https://access.redhat.com/solutions/6613291 - External users are not able to create token on Ansible Tower. + - name: ALLOW_OAUTH2_FOR_EXTERNAL_USERS + value: true + - name: ORG_ADMINS_CAN_SEE_ALL_USERS + value: false +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/app-examples/controller_settings_user_interface.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/app-examples/controller_settings_user_interface.yml new file mode 100644 index 00000000..f465d180 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/app-examples/controller_settings_user_interface.yml @@ -0,0 +1,5 @@ +--- +controller_settings: + - name: CUSTOM_LOGIN_INFO + value: "This is a custom message provided by Customer - Consulting Barcelona" +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/controller_settings.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/controller_settings.yml new file mode 100644 index 00000000..40aea26d --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_settings.d/controller_settings.yml @@ -0,0 +1,3 @@ +--- +controller_settings: [] +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_users.d/app-demo/controller_user_accounts_org1.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_users.d/app-demo/controller_user_accounts_org1.yml new file mode 100644 index 00000000..fb71e061 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_users.d/app-demo/controller_user_accounts_org1.yml @@ -0,0 +1,15 @@ +--- +controller_user_accounts: + - username: "adminorg1" + password: "password" + email: "adminorg1@example.com" + firstname: "adminorg1" + lastname: "adminorg1" + is_auditor: false + is_superuser: false + + - username: "userorg1" + password: "password" + email: "userorg1@example.com" + is_superuser: false +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_users.d/app-demo/controller_user_accounts_org2.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_users.d/app-demo/controller_user_accounts_org2.yml new file mode 100644 index 00000000..688dfca1 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_users.d/app-demo/controller_user_accounts_org2.yml @@ -0,0 +1,15 @@ +--- +controller_user_accounts: + - username: "adminorg2" + password: "password" + email: "adminorg2@example.com" + firstname: "adminorg2" + lastname: "adminorg2" + is_auditor: false + is_superuser: false + + - username: "userorg2" + password: "password" + email: "userorg2@example.com" + is_superuser: false +... diff --git a/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_users.d/controller_user_accounts.yml b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_users.d/controller_user_accounts.yml new file mode 100644 index 00000000..06dd02b0 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/ExampleOrg/env/prod/controller_users.d/controller_user_accounts.yml @@ -0,0 +1,11 @@ +--- +controller_user_accounts: + - username: "admin" + password: "password" + email: "admin@example.com" + firstname: "admin" + lastname: "admin" + is_auditor: false + is_superuser: true + update_secrets: false +... diff --git a/tests/automatetheautomation/orgs_vars/env/dev/configure_connection_controller_credentials.yml b/tests/automatetheautomation/orgs_vars/env/dev/configure_connection_controller_credentials.yml new file mode 100644 index 00000000..efe524d2 --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/env/dev/configure_connection_controller_credentials.yml @@ -0,0 +1,6 @@ +--- +vault_controller_username: 'admin' +vault_controller_password: 'password' +vault_controller_hostname: controller-dev.lab.example.com +vault_controller_validate_certs: false +... diff --git a/tests/automatetheautomation/orgs_vars/env/prod/configure_connection_controller_credentials.yml b/tests/automatetheautomation/orgs_vars/env/prod/configure_connection_controller_credentials.yml new file mode 100644 index 00000000..aee1768c --- /dev/null +++ b/tests/automatetheautomation/orgs_vars/env/prod/configure_connection_controller_credentials.yml @@ -0,0 +1,6 @@ +--- +vault_controller_username: 'admin' +vault_controller_password: 'password' +vault_controller_hostname: controller-prod.lab.example.com +vault_controller_validate_certs: false +... diff --git a/tests/automatetheautomation/pictures/AAP_CasC_Worflow.png b/tests/automatetheautomation/pictures/AAP_CasC_Worflow.png new file mode 100644 index 00000000..3f9aeb90 Binary files /dev/null and b/tests/automatetheautomation/pictures/AAP_CasC_Worflow.png differ diff --git a/tests/configs/custom/applications.yml b/tests/configs/custom/applications.yml index 9733dc76..05da63a4 100644 --- a/tests/configs/custom/applications.yml +++ b/tests/configs/custom/applications.yml @@ -1,5 +1,5 @@ --- -controller_applications: +aap_applications: - name: controller_application-app1 organization: Satellite authorization_grant_type: password diff --git a/tests/configs/custom/controller_auth.yml b/tests/configs/custom/controller_auth.yml index 3df52670..eaa2955b 100644 --- a/tests/configs/custom/controller_auth.yml +++ b/tests/configs/custom/controller_auth.yml @@ -1,8 +1,8 @@ # User may add controller auth creds to this file and encrypt it using `ansible-vault` --- -# controller_hostname: ansible-controller-web-svc-test-project.example.com -controller_username: admin -controller_password: password +# aap_hostname: ansible-controller-web-svc-test-project.example.com +aap_username: admin +aap_password: password controller_validate_certs: false controller_configuration_enforce_defaults: true ... diff --git a/tests/configs/custom/organizations.yml b/tests/configs/custom/organizations.yml index 75f8c088..679f2ec3 100644 --- a/tests/configs/custom/organizations.yml +++ b/tests/configs/custom/organizations.yml @@ -1,5 +1,5 @@ --- -controller_organizations: +aap_organizations: - name: Satellite - name: Default default_environment: Automation Hub Default Execution Environment diff --git a/tests/configs/custom/teams.yml b/tests/configs/custom/teams.yml index bffe7eb8..9ddd413e 100644 --- a/tests/configs/custom/teams.yml +++ b/tests/configs/custom/teams.yml @@ -1,5 +1,5 @@ --- -controller_teams: +aap_teams: - name: satellite-qe organization: Satellite - name: satlab-admin diff --git a/tests/configs/custom/user_accounts.yml b/tests/configs/custom/user_accounts.yml index 7ee16217..ccf7aabc 100644 --- a/tests/configs/custom/user_accounts.yml +++ b/tests/configs/custom/user_accounts.yml @@ -1,19 +1,19 @@ --- -controller_user_accounts: +aap_user_accounts: - user: controller_user is_superuser: false - password: controller_password + password: aap_password - user: second_controller_user is_superuser: false organization: Default - password: controller_password + password: aap_password - user: controller_auditor is_system_auditor: true - password: controller_password + password: aap_password - user: controller_admin is_superuser: true - password: controller_password + password: aap_password - user: second_controller_admin is_superuser: true - password: controller_password + password: aap_password ... diff --git a/tests/configs/fc/Default/applications/3_controller_application-app3.yaml b/tests/configs/fc/Default/applications/3_controller_application-app3.yaml index 7de571b9..6f10d7bf 100644 --- a/tests/configs/fc/Default/applications/3_controller_application-app3.yaml +++ b/tests/configs/fc/Default/applications/3_controller_application-app3.yaml @@ -1,5 +1,5 @@ --- -controller_applications: +aap_applications: - name: "controller_application-app3" description: "" organization: "Default" diff --git a/tests/configs/fc/Default/current_organization.yaml b/tests/configs/fc/Default/current_organization.yaml index 7c053e6e..57b0c4fe 100644 --- a/tests/configs/fc/Default/current_organization.yaml +++ b/tests/configs/fc/Default/current_organization.yaml @@ -1,5 +1,5 @@ --- -controller_organizations: +aap_organizations: - name: "Default" description: "" ... diff --git a/tests/configs/fc/Default/teams/3_differential-1.yaml b/tests/configs/fc/Default/teams/3_differential-1.yaml index bc6c0cad..5bad63dc 100644 --- a/tests/configs/fc/Default/teams/3_differential-1.yaml +++ b/tests/configs/fc/Default/teams/3_differential-1.yaml @@ -1,5 +1,5 @@ --- -controller_teams: +aap_teams: - name: "differential-1" description: "" organization: "Default" diff --git a/tests/configs/fc/Default/teams/4_differential-2.yaml b/tests/configs/fc/Default/teams/4_differential-2.yaml index b4275553..cad53fdd 100644 --- a/tests/configs/fc/Default/teams/4_differential-2.yaml +++ b/tests/configs/fc/Default/teams/4_differential-2.yaml @@ -1,5 +1,5 @@ --- -controller_teams: +aap_teams: - name: "differential-2" description: "" organization: "Default" diff --git a/tests/configs/fc/ORGANIZATIONLESS/users/admin.yaml b/tests/configs/fc/ORGANIZATIONLESS/users/admin.yaml index 03a5f8ca..da6719fb 100644 --- a/tests/configs/fc/ORGANIZATIONLESS/users/admin.yaml +++ b/tests/configs/fc/ORGANIZATIONLESS/users/admin.yaml @@ -1,5 +1,5 @@ --- -controller_user_accounts: +aap_user_accounts: - username: "admin" password: "INITIAL" email: "admin@example.com" diff --git a/tests/configs/fc/ORGANIZATIONLESS/users/controller_user.yaml b/tests/configs/fc/ORGANIZATIONLESS/users/controller_user.yaml index fa855a22..69c3fd99 100644 --- a/tests/configs/fc/ORGANIZATIONLESS/users/controller_user.yaml +++ b/tests/configs/fc/ORGANIZATIONLESS/users/controller_user.yaml @@ -1,5 +1,5 @@ --- -controller_user_accounts: +aap_user_accounts: - username: "controller_user" password: "INITIAL" email: "" diff --git a/tests/configs/fc/Recursive Workflows/current_organization.yaml b/tests/configs/fc/Recursive Workflows/current_organization.yaml index 5d9c12ea..71825a2d 100644 --- a/tests/configs/fc/Recursive Workflows/current_organization.yaml +++ b/tests/configs/fc/Recursive Workflows/current_organization.yaml @@ -1,5 +1,5 @@ --- -controller_organizations: +aap_organizations: - name: "Recursive Workflows" description: "Organization to show how to create and use a Workflow tha is calling another workflows" ... diff --git a/tests/configs/fc/Satellite/applications/1_controller_application-app1.yaml b/tests/configs/fc/Satellite/applications/1_controller_application-app1.yaml index 72655d84..4f3419bf 100644 --- a/tests/configs/fc/Satellite/applications/1_controller_application-app1.yaml +++ b/tests/configs/fc/Satellite/applications/1_controller_application-app1.yaml @@ -1,5 +1,5 @@ --- -controller_applications: +aap_applications: - name: "controller_application-app1" description: "" organization: "Satellite" diff --git a/tests/configs/fc/Satellite/current_organization.yaml b/tests/configs/fc/Satellite/current_organization.yaml index 275ce735..eb73af7f 100644 --- a/tests/configs/fc/Satellite/current_organization.yaml +++ b/tests/configs/fc/Satellite/current_organization.yaml @@ -1,5 +1,5 @@ --- -controller_organizations: +aap_organizations: - name: "Satellite" description: "" ... diff --git a/tests/configs/fc/Test-dispatch-dependencies/current_organization.yaml b/tests/configs/fc/Test-dispatch-dependencies/current_organization.yaml index a97ad4e3..abe78864 100644 --- a/tests/configs/fc/Test-dispatch-dependencies/current_organization.yaml +++ b/tests/configs/fc/Test-dispatch-dependencies/current_organization.yaml @@ -1,5 +1,5 @@ --- -controller_organizations: +aap_organizations: - name: "Test-dispatch-dependencies" description: "" notification_templates_approvals: diff --git a/tests/configs/fcf/applications.yaml b/tests/configs/fcf/applications.yaml index f037fba4..5ed0c439 100644 --- a/tests/configs/fcf/applications.yaml +++ b/tests/configs/fcf/applications.yaml @@ -1,5 +1,5 @@ --- -controller_applications: +aap_applications: - name: "controller_application-app3" description: "" organization: "Default" diff --git a/tests/configs/fcf/organizations.yaml b/tests/configs/fcf/organizations.yaml index 6c1b2042..1c32084b 100644 --- a/tests/configs/fcf/organizations.yaml +++ b/tests/configs/fcf/organizations.yaml @@ -1,5 +1,5 @@ --- -controller_organizations: +aap_organizations: - name: "Default" description: "" - name: "Recursive Workflows" diff --git a/tests/configs/fcf/teams.yaml b/tests/configs/fcf/teams.yaml index a8cc586c..1d04cf25 100644 --- a/tests/configs/fcf/teams.yaml +++ b/tests/configs/fcf/teams.yaml @@ -1,5 +1,5 @@ --- -controller_teams: +aap_teams: - name: "differential-1" description: "" organization: "Default" diff --git a/tests/configs/fcf/users.yaml b/tests/configs/fcf/users.yaml index 28d2b2fe..d5ba1480 100644 --- a/tests/configs/fcf/users.yaml +++ b/tests/configs/fcf/users.yaml @@ -1,5 +1,5 @@ --- -controller_user_accounts: +aap_user_accounts: - username: "admin" password: "INITIAL" email: "admin@example.com" diff --git a/tests/configs/gv/group_vars/all/aap_install.yml b/tests/configs/gv/group_vars/all/aap_install.yml index cc5acd20..c42f32ba 100644 --- a/tests/configs/gv/group_vars/all/aap_install.yml +++ b/tests/configs/gv/group_vars/all/aap_install.yml @@ -66,14 +66,14 @@ aap_setup_prep_inv_secrets: # aap_setup_inst_inventory: inventory aap_setup_inst_extra_vars: create_preload_data: false -# controller_hostname/username/password/validate_certs: ??????????????????????? +# aap_hostname/username/password/validate_certs: ??????????????????????? # ah_hostname/username/password/validate_certs: ??????????????????????? aap_setup_inst_force: true -controller_hostname: "{{ aap_setup_prep_inv_nodes['automationcontroller'][0] }}" -controller_username: "{{ controller_username | default('admin') }}" -controller_password: "{{ ansible_password | default('Password1234!') }}" -# controller_oauthtoken: "" +aap_hostname: "{{ aap_setup_prep_inv_nodes['automationcontroller'][0] }}" +aap_username: "{{ aap_username | default('admin') }}" +aap_password: "{{ ansible_password | default('Password1234!') }}" +# aap_oauthtoken: "" # controller_config_file: "" controller_validate_certs: false diff --git a/tests/configs/gv/group_vars/all/applications.yml b/tests/configs/gv/group_vars/all/applications.yml index 716dbb3b..21e2e8c7 100644 --- a/tests/configs/gv/group_vars/all/applications.yml +++ b/tests/configs/gv/group_vars/all/applications.yml @@ -1,5 +1,5 @@ --- -controller_applications_all: +aap_applications_all: - name: config_as_code_api description: launch controller config job template organization: config_as_code diff --git a/tests/configs/gv/group_vars/all/auth.yml b/tests/configs/gv/group_vars/all/auth.yml index 6c8c3bfd..965f9a50 100644 --- a/tests/configs/gv/group_vars/all/auth.yml +++ b/tests/configs/gv/group_vars/all/auth.yml @@ -1,8 +1,8 @@ # User may add controller auth creds to this file and encrypt it using `ansible-vault` --- -controller_hostname: "{{ controller_host | default(groups['automationcontroller'][0]) }}:{{ controller_port | default(443) }}" -controller_username: "{{ controller_user | default('admin') }}" -controller_password: "{{ controller_pass }}" +aap_hostname: "{{ controller_host | default(groups['automationcontroller'][0]) }}:{{ controller_port | default(443) }}" +aap_username: "{{ controller_user | default('admin') }}" +aap_password: "{{ controller_pass }}" controller_validate_certs: false ah_host: "{{ ah_hostname | default(groups['automationhub'][0]) }}:{{ ah_port | default(443) }}" diff --git a/tests/configs/gv/group_vars/all/credentials.yml b/tests/configs/gv/group_vars/all/credentials.yml index fb101d80..ef52a75e 100644 --- a/tests/configs/gv/group_vars/all/credentials.yml +++ b/tests/configs/gv/group_vars/all/credentials.yml @@ -5,9 +5,9 @@ controller_credentials_all: organization: config_as_code description: aap admin account inputs: - host: "{{ controller_hostname }}" - username: "{{ controller_username }}" - password: "{{ controller_password }}" + host: "{{ aap_hostname }}" + username: "{{ aap_username }}" + password: "{{ aap_password }}" verify_ssl: false - name: ah_admin_user_pass diff --git a/tests/configs/gv/group_vars/all/organizations.yml b/tests/configs/gv/group_vars/all/organizations.yml index c3dedb02..5509729a 100644 --- a/tests/configs/gv/group_vars/all/organizations.yml +++ b/tests/configs/gv/group_vars/all/organizations.yml @@ -1,5 +1,5 @@ --- -controller_organizations_all: +aap_organizations_all: - name: config_as_code galaxy_credentials: - ah_published diff --git a/tests/configs/gv/group_vars/all/teams.yml b/tests/configs/gv/group_vars/all/teams.yml index f060aa9c..227f5839 100644 --- a/tests/configs/gv/group_vars/all/teams.yml +++ b/tests/configs/gv/group_vars/all/teams.yml @@ -1,5 +1,5 @@ --- -controller_teams_all: +aap_teams_all: - name: config_as_code_admin organization: config_as_code ... diff --git a/tests/configs/gv/group_vars/all/users.yml b/tests/configs/gv/group_vars/all/users.yml index 0e76bdd1..16a2ae3e 100644 --- a/tests/configs/gv/group_vars/all/users.yml +++ b/tests/configs/gv/group_vars/all/users.yml @@ -1,5 +1,5 @@ --- -controller_user_accounts_all: +aap_user_accounts_all: - user: api_user is_superuser: false password: "{{ controller_api_user_pass }}" diff --git a/tests/configs/gv/group_vars/dev/applications.yml b/tests/configs/gv/group_vars/dev/applications.yml index 48c78e47..874dc9d8 100644 --- a/tests/configs/gv/group_vars/dev/applications.yml +++ b/tests/configs/gv/group_vars/dev/applications.yml @@ -1,3 +1,3 @@ --- -controller_applications_dev: [] +aap_applications_dev: [] ... diff --git a/tests/configs/gv/group_vars/dev/main.yml b/tests/configs/gv/group_vars/dev/main.yml index be17c091..43247bd7 100644 --- a/tests/configs/gv/group_vars/dev/main.yml +++ b/tests/configs/gv/group_vars/dev/main.yml @@ -1,5 +1,5 @@ --- -controller_applications: "{{ controller_applications_all + controller_applications_dev }}" +aap_applications: "{{ aap_applications_all + aap_applications_dev }}" controller_credential_input_sources: "{{ controller_credential_input_sources_all + controller_credential_input_sources_dev }}" controller_credential_types: "{{ controller_credential_types_all + controller_credential_types_dev }}" controller_credentials: "{{ controller_credentials_all + controller_credentials_dev }}" @@ -12,13 +12,13 @@ controller_inventory_sources: "{{ controller_inventory_sources_all + controller_ controller_templates: "{{ controller_templates_all + controller_templates_dev }}" controller_labels: "{{ controller_labels_all + controller_labels_dev }}" controller_notifications: "{{ controller_notifications_all + controller_notifications_dev }}" -controller_organizations: "{{ controller_organizations_all + controller_organizations_dev }}" +aap_organizations: "{{ aap_organizations_all + aap_organizations_dev }}" controller_projects: "{{ controller_projects_all + controller_projects_dev }}" controller_roles: "{{ controller_roles_all + controller_roles_dev }}" controller_schedules: "{{ controller_schedules_all + controller_schedules_dev }}" controller_settings: "{{ controller_settings_all | combine(controller_settings_dev, list_merge='append', recursive=true) }}" -controller_teams: "{{ controller_teams_all + controller_teams_dev }}" -controller_user_accounts: "{{ controller_user_accounts_all + controller_user_accounts_dev }}" +aap_teams: "{{ aap_teams_all + aap_teams_dev }}" +aap_user_accounts: "{{ aap_user_accounts_all + aap_user_accounts_dev }}" controller_workflows: "{{ controller_workflows_all + controller_workflows_dev }}" env: dev scm_branch: "" # when you want it to be default branch just set to "" diff --git a/tests/configs/gv/group_vars/dev/organizations.yml b/tests/configs/gv/group_vars/dev/organizations.yml index 0bce7e1c..2b48657f 100644 --- a/tests/configs/gv/group_vars/dev/organizations.yml +++ b/tests/configs/gv/group_vars/dev/organizations.yml @@ -1,3 +1,3 @@ --- -controller_organizations_dev: [] +aap_organizations_dev: [] ... diff --git a/tests/configs/gv/group_vars/dev/teams.yml b/tests/configs/gv/group_vars/dev/teams.yml index 20e2327c..63ef3e68 100644 --- a/tests/configs/gv/group_vars/dev/teams.yml +++ b/tests/configs/gv/group_vars/dev/teams.yml @@ -1,3 +1,3 @@ --- -controller_teams_dev: [] +aap_teams_dev: [] ... diff --git a/tests/configs/gv/group_vars/dev/users.yml b/tests/configs/gv/group_vars/dev/users.yml index 6d552386..40cf0257 100644 --- a/tests/configs/gv/group_vars/dev/users.yml +++ b/tests/configs/gv/group_vars/dev/users.yml @@ -1,3 +1,3 @@ --- -controller_user_accounts_dev: [] +aap_user_accounts_dev: [] ... diff --git a/tests/configs/gv/group_vars/prod/applications.yml b/tests/configs/gv/group_vars/prod/applications.yml index ca670f15..b8b48359 100644 --- a/tests/configs/gv/group_vars/prod/applications.yml +++ b/tests/configs/gv/group_vars/prod/applications.yml @@ -1,3 +1,3 @@ --- -controller_applications_prod: [] +aap_applications_prod: [] ... diff --git a/tests/configs/gv/group_vars/prod/main.yml b/tests/configs/gv/group_vars/prod/main.yml index a95e1398..b5a4ab5e 100644 --- a/tests/configs/gv/group_vars/prod/main.yml +++ b/tests/configs/gv/group_vars/prod/main.yml @@ -1,5 +1,5 @@ --- -controller_applications: "{{ controller_applications_all + controller_applications_prod }}" +aap_applications: "{{ aap_applications_all + aap_applications_prod }}" controller_credential_input_sources: "{{ controller_credential_input_sources_all + controller_credential_input_sources_prod }}" controller_credential_types: "{{ controller_credential_types_all + controller_credential_types_prod }}" controller_credentials: "{{ controller_credentials_all + controller_credentials_prod }}" @@ -12,13 +12,13 @@ controller_inventory_sources: "{{ controller_inventory_sources_all + controller_ controller_templates: "{{ controller_templates_all + controller_templates_prod }}" controller_labels: "{{ controller_labels_all + controller_labels_prod }}" controller_notifications: "{{ controller_notifications_all + controller_notifications_prod }}" -controller_organizations: "{{ controller_organizations_all + controller_organizations_prod }}" +aap_organizations: "{{ aap_organizations_all + aap_organizations_prod }}" controller_projects: "{{ controller_projects_all + controller_projects_prod }}" controller_roles: "{{ controller_roles_all + controller_roles_prod }}" controller_schedules: "{{ controller_schedules_all + controller_schedules_prod }}" controller_settings: "{{ controller_settings_all | combine(controller_settings_prod, list_merge='append', recursive=true) }}" -controller_teams: "{{ controller_teams_all + controller_teams_prod }}" -controller_user_accounts: "{{ controller_user_accounts_all + controller_user_accounts_prod }}" +aap_teams: "{{ aap_teams_all + aap_teams_prod }}" +aap_user_accounts: "{{ aap_user_accounts_all + aap_user_accounts_prod }}" controller_workflows: "{{ controller_workflows_all + controller_workflows_prod }}" env: prod scm_branch: "" # when you want it to be default branch just set to "" diff --git a/tests/configs/gv/group_vars/prod/organizations.yml b/tests/configs/gv/group_vars/prod/organizations.yml index ad51eecc..fb633345 100644 --- a/tests/configs/gv/group_vars/prod/organizations.yml +++ b/tests/configs/gv/group_vars/prod/organizations.yml @@ -1,3 +1,3 @@ --- -controller_organizations_prod: [] +aap_organizations_prod: [] ... diff --git a/tests/configs/gv/group_vars/prod/teams.yml b/tests/configs/gv/group_vars/prod/teams.yml index 771e69a9..839d713c 100644 --- a/tests/configs/gv/group_vars/prod/teams.yml +++ b/tests/configs/gv/group_vars/prod/teams.yml @@ -1,3 +1,3 @@ --- -controller_teams_prod: [] +aap_teams_prod: [] ... diff --git a/tests/configs/gv/group_vars/prod/users.yml b/tests/configs/gv/group_vars/prod/users.yml index a2dacee7..7b5e327e 100644 --- a/tests/configs/gv/group_vars/prod/users.yml +++ b/tests/configs/gv/group_vars/prod/users.yml @@ -1,3 +1,3 @@ --- -controller_user_accounts_prod: [] +aap_user_accounts_prod: [] ... diff --git a/tests/test_filetree_create.yaml b/tests/test_filetree_create.yaml index c501a06a..798b48d2 100644 --- a/tests/test_filetree_create.yaml +++ b/tests/test_filetree_create.yaml @@ -7,20 +7,32 @@ - always vars: # Controller connection variables - controller_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" - controller_password: "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" - controller_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" + aap_username: "{{ vault_aap_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" + aap_password: "{{ vault_aap_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" + aap_hostname: "{{ vault_aap_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" controller_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}" tasks: - name: "Setup authentication (block)" no_log: "{{ controller_configuration_filetree_create_secure_logging | default(true) }}" - when: controller_oauthtoken is not defined + when: aap_oauthtoken is not defined block: + # - name: "Create a new token using username/password" + # awx.awx.token: + # description: 'Token for Automated Management' + # scope: "write" + # state: present + # controller_host: "{{ aap_hostname }}" + # aap_username: "{{ aap_username }}" + # aap_password: "{{ aap_password }}" + # validate_certs: "{{ controller_validate_certs }}" + # register: authtoken_res_new + # - debug: var=authtoken_res_new + - name: "Get the Authentication Token for the future requests" ansible.builtin.uri: - url: "https://{{ controller_hostname }}/api/v2/tokens/" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}/api/gateway/v1/tokens/" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: POST force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" @@ -29,8 +41,8 @@ - name: "Set the oauth token to be used since now" ansible.builtin.set_fact: - controller_oauthtoken: "{{ authtoken_res.json.token }}" - controller_oauthtoken_url: "{{ authtoken_res.json.url }}" + aap_oauthtoken: "{{ authtoken_res.json.token }}" + aap_oauthtoken_url: "{{ authtoken_res.json.url }}" - name: "Test the filetree_create role" # Run example: ansible-playbook test_filetree_create.yaml -e@vault-aap-controller.yaml @@ -41,9 +53,9 @@ gather_facts: false vars: # Controller connection variables - controller_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" - controller_password: "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" - controller_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" + aap_username: "{{ vault_aap_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" + aap_password: "{{ vault_aap_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" + aap_hostname: "{{ vault_aap_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" controller_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}" # output_path: "/tmp/filetree_output_default" pre_tasks: @@ -94,21 +106,21 @@ - always vars: # Controller connection variables - controller_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" - controller_password: "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" - controller_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" + aap_username: "{{ vault_aap_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" + aap_password: "{{ vault_aap_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" + aap_hostname: "{{ vault_aap_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" controller_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}" tasks: - name: "Delete the Authentication Token used" ansible.builtin.uri: - url: "https://{{ controller_hostname }}{{ controller_oauthtoken_url }}" - user: "{{ controller_username }}" - password: "{{ controller_password }}" + url: "https://{{ aap_hostname }}{{ aap_oauthtoken_url }}" + user: "{{ aap_username }}" + password: "{{ aap_password }}" method: DELETE force_basic_auth: true validate_certs: "{{ controller_validate_certs }}" status_code: 204 - when: controller_oauthtoken_url is defined + when: aap_oauthtoken_url is defined # Run example: ansible-playbook test_filetree_create.yaml -e@vault-aap-controller.yaml # Run example: ansible-playbook test_filetree_create.yaml -e@vault-aap-controller.yaml --tags default diff --git a/tests/test_filetree_read.yaml b/tests/test_filetree_read.yaml index b60e483c..4f413ff7 100644 --- a/tests/test_filetree_read.yaml +++ b/tests/test_filetree_read.yaml @@ -15,17 +15,17 @@ orgs: '' # Controller Directory Path filetree_controller_settings: &custom_configs_path "./configs/custom" - filetree_controller_organizations: *custom_configs_path + filetree_aap_organizations: *custom_configs_path filetree_controller_labels: *custom_configs_path - filetree_controller_user_accounts: *custom_configs_path - filetree_controller_teams: *custom_configs_path + filetree_aap_user_accounts: *custom_configs_path + filetree_aap_teams: *custom_configs_path filetree_controller_credential_types: *custom_configs_path filetree_controller_credentials: *custom_configs_path filetree_controller_credential_input_sources: *custom_configs_path filetree_controller_notifications: *custom_configs_path filetree_controller_projects: *custom_configs_path filetree_controller_execution_environments: *custom_configs_path - filetree_controller_applications: *custom_configs_path + filetree_aap_applications: *custom_configs_path filetree_controller_inventories: *custom_configs_path filetree_controller_inventory_sources: *custom_configs_path filetree_controller_instance_groups: *custom_configs_path @@ -51,17 +51,17 @@ orgs: '' # Controller Directory Path filetree_controller_settings: &fc_configs_path "./configs/fc" - filetree_controller_organizations: *fc_configs_path + filetree_aap_organizations: *fc_configs_path filetree_controller_labels: *fc_configs_path - filetree_controller_user_accounts: *fc_configs_path - filetree_controller_teams: *fc_configs_path + filetree_aap_user_accounts: *fc_configs_path + filetree_aap_teams: *fc_configs_path filetree_controller_credential_types: *fc_configs_path filetree_controller_credentials: *fc_configs_path filetree_controller_credential_input_sources: *fc_configs_path filetree_controller_notifications: *fc_configs_path filetree_controller_projects: *fc_configs_path filetree_controller_execution_environments: *fc_configs_path - filetree_controller_applications: *fc_configs_path + filetree_aap_applications: *fc_configs_path filetree_controller_inventories: *fc_configs_path filetree_controller_inventory_sources: *fc_configs_path filetree_controller_instance_groups: *fc_configs_path @@ -87,17 +87,17 @@ orgs: '' # Controller Directory Path filetree_controller_settings: &fcf_configs_path "./configs/fcf" - filetree_controller_organizations: *fcf_configs_path + filetree_aap_organizations: *fcf_configs_path filetree_controller_labels: *fcf_configs_path - filetree_controller_user_accounts: *fcf_configs_path - filetree_controller_teams: *fcf_configs_path + filetree_aap_user_accounts: *fcf_configs_path + filetree_aap_teams: *fcf_configs_path filetree_controller_credential_types: *fcf_configs_path filetree_controller_credentials: *fcf_configs_path filetree_controller_credential_input_sources: *fcf_configs_path filetree_controller_notifications: *fcf_configs_path filetree_controller_projects: *fcf_configs_path filetree_controller_execution_environments: *fcf_configs_path - filetree_controller_applications: *fcf_configs_path + filetree_aap_applications: *fcf_configs_path filetree_controller_inventories: *fcf_configs_path filetree_controller_inventory_sources: *fcf_configs_path filetree_controller_instance_groups: *fcf_configs_path @@ -121,9 +121,9 @@ # Controller connection variables controller_configuration_projects_async_retries: 60 controller_configuration_projects_async_delay: 2 - controller_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" - controller_password: "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" - controller_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" + aap_username: "{{ vault_aap_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}" + aap_password: "{{ vault_aap_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}" + aap_hostname: "{{ vault_aap_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}" controller_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}" ah_token: "dummytoken" # filetree_read mandatory parameters @@ -131,17 +131,17 @@ orgs: '' # Controller Directory Path filetree_controller_settings: &gv_configs_path "configs/gv/group_vars/test" - filetree_controller_organizations: *gv_configs_path + filetree_aap_organizations: *gv_configs_path filetree_controller_labels: *gv_configs_path - filetree_controller_user_accounts: *gv_configs_path - filetree_controller_teams: *gv_configs_path + filetree_aap_user_accounts: *gv_configs_path + filetree_aap_teams: *gv_configs_path filetree_controller_credential_types: *gv_configs_path filetree_controller_credentials: *gv_configs_path filetree_controller_credential_input_sources: *gv_configs_path filetree_controller_notifications: *gv_configs_path filetree_controller_projects: *gv_configs_path filetree_controller_execution_environments: *gv_configs_path - filetree_controller_applications: *gv_configs_path + filetree_aap_applications: *gv_configs_path filetree_controller_inventories: *gv_configs_path filetree_controller_inventory_sources: *gv_configs_path filetree_controller_instance_groups: *gv_configs_path