mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-20 07:43:35 -05:00
fix the api-lint fix the api-lint add the descrition to the bulk job launch module params add the description for the description field add the description for the description field add docs for the bulk api fix the models on the bulk api serializers fix some of the issues highlighted in the code review better use of role model remove comments better error message revert the PrimaryKeyRelatedField for unified_job_template and inventory
70 lines
1.9 KiB
YAML
70 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
|