Files
awx/awx_collection/tests/integration/targets/bulk_job_launch/main.yml
Elijah DeLee 9e037f1a02 fixup return values for bulk launch and host create in awxkit
Enabled the params bulk job

make black

make black again

Fixed inventory and organization input params for bulk modules

add collection integration tests

Fix cli return errors

fix test completeness
2023-03-08 12:58:12 -05:00

69 lines
1.9 KiB
YAML

---
- name: Generate a random string for test
set_fact:
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: test_id is not defined
- name: Generate a unique name
set_fact:
bulk_job_name: "AWX-Collection-tests-bulk_job_launch-{{ test_id }}"
- name: Get our collection package
controller_meta:
register: controller_meta
- name: Generate the name of our plugin
set_fact:
plugin_name: "{{ controller_meta.prefix }}.controller_api"
- name: Get Inventory
set_fact:
inventory_id: "{{ lookup(plugin_name, 'inventories', query_params={'name': 'Demo Inventory'}, return_ids=True ) }}"
- name: Create a Job Template
job_template:
name: "{{ bulk_job_name }}"
copy_from: "Demo Job Template"
ask_variables_on_launch: true
ask_inventory_on_launch: true
ask_skip_tags_on_launch: true
allow_simultaneous: true
state: present
register: jt_result
- name: Create Bulk Job
bulk_job_launch:
name: "{{ bulk_job_name }}"
jobs:
- unified_job_template: "{{ jt_result.id }}"
inventory: "{{ inventory_id }}"
skip_tags: "skipfoo,skipbar"
extra_data:
animal: fish
color: orange
- unified_job_template: "{{ jt_result.id }}"
extra_vars:
animal: bear
food: carrot
skip_tags: "skipbaz"
job_tags: "Hello World"
limit: "localhost"
wait: False
inventory: "{{ inventory_id }}"
register: result
- assert:
that:
- result is not failed
- "'id' in result"
- result['job_info']['skip_tags'] == "skipbaz"
- result['job_info']['limit'] == "localhost"
- result['job_info']['job_tags'] == "Hello World"
- result['job_info']['inventory'] == {{ inventory_id }}
- "result['job_info']['extra_vars'] == '{\"animal\": \"bear\", \"food\": \"carrot\"}'"
# cleanup
- name: Delete Job Template
job_template:
name: "{{ bulk_job_name }}"
state: absent