Adding EE/IG/labels/forks/timeout/job_slice_count to schedules

Modifying schedules to work with related fields

Updating awx.awx.workflow_job_template_node
This commit is contained in:
John Westcott IV
2022-08-24 14:31:05 -04:00
committed by Alan Rominger
parent 2e217ed466
commit 809df74050
15 changed files with 686 additions and 50 deletions

View File

@@ -7,11 +7,17 @@
set_fact:
org_name: "AWX-Collection-tests-organization-org-{{ test_id }}"
sched1: "AWX-Collection-tests-schedule-sched1-{{ test_id }}"
sched2: "AWX-Collection-tests-schedule-sched2-{{ test_id }}"
cred1: "AWX-Collection-tests-schedule-cred1-{{ test_id }}"
proj1: "AWX-Collection-tests-schedule-proj1-{{ test_id }}"
proj2: "AWX-Collection-tests-schedule-proj2-{{ test_id }}"
jt1: "AWX-Collection-tests-schedule-jt1-{{ test_id }}"
jt2: "AWX-Collection-tests-schedule-jt1-{{ test_id }}"
ee1: "AWX-Collection-tests-schedule-ee1-{{ test_id }}"
label1: "AWX-Collection-tests-schedule-l1-{{ test_id }}"
label2: "AWX-Collection-tests-schedule-l2-{{ test_id }}"
ig1: "AWX-Collection-tests-schedule-ig1-{{ test_id }}"
ig2: "AWX-Collection-tests-schedule-ig2-{{ test_id }}"
- block:
- name: Try to create without an rrule
@@ -124,6 +130,12 @@
ask_limit_on_launch: true
ask_diff_mode_on_launch: true
ask_verbosity_on_launch: true
ask_execution_environment_on_launch: true
ask_forks_on_launch: true
ask_instance_groups_on_launch: true
ask_job_slice_count_on_launch: true
ask_labels_on_launch: true
ask_timeout_on_launch: true
job_type: run
state: present
register: result
@@ -132,14 +144,33 @@
that:
- "result is changed"
- name: Create labels
label:
name: "{{ item }}"
organization: "{{ org_name }}"
loop:
- "{{ label1 }}"
- "{{ label2 }}"
- name: Create an execution environment
execution_environment:
name: "{{ ee1 }}"
image: "junk"
- name: Create instance groups
instance_group:
name: "{{ item }}"
loop:
- "{{ ig1 }}"
- "{{ ig2 }}"
- name: Create with options that the JT does support
schedule:
name: "{{ sched1 }}"
name: "{{ sched2 }}"
state: present
unified_job_template: "{{ jt1 }}"
rrule: "DTSTART:20191219T130551Z RRULE:FREQ=WEEKLY;INTERVAL=1;COUNT=1"
description: "This hopefully will not work"
description: "This hopefully will work"
extra_data:
some: var
inventory: Demo Inventory
@@ -153,6 +184,33 @@
diff_mode: true
verbosity: 4
enabled: true
execution_environment: "{{ ee1 }}"
forks: 10
instance_groups:
- "{{ ig1 }}"
- "{{ ig2 }}"
job_slice_count: 10
labels:
- "{{ label1 }}"
- "{{ label2 }}"
timeout: 10
register: result
ignore_errors: true
- assert:
that:
- "result is changed"
- name: Reset some options
schedule:
name: "{{ sched2 }}"
state: present
execution_environment: ""
forks: 1
instance_groups: []
job_slice_count: 1
labels: []
timeout: 60
register: result
ignore_errors: true
@@ -163,7 +221,7 @@
- name: Disable a schedule
schedule:
name: "{{ sched1 }}"
unified_job_template: "{{ jt1 }}"
unified_job_template: "Demo Job Template"
state: present
enabled: "false"
register: result
@@ -213,42 +271,48 @@
- result is changed
always:
- name: Delete the schedule
- name: Delete the schedules
schedule:
name: "{{ sched1 }}"
name: "{{ item }}"
state: absent
loop:
- "{{ sched1 }}"
- "{{ sched2 }}"
ignore_errors: True
- name: Delete the jt
- name: Delete the jt1
job_template:
name: "{{ jt1 }}"
project: "{{ proj1 }}"
playbook: hello_world.yml
state: absent
ignore_errors: True
- name: Delete the jt
- name: Delete the jt2
job_template:
name: "{{ jt2 }}"
project: "{{ proj2 }}"
playbook: hello_world.yml
state: absent
ignore_errors: True
- name: Delete the Project
- name: Delete the Project2
project:
name: "{{ proj2 }}"
organization: "{{ org_name }}"
state: absent
scm_type: git
scm_url: https://github.com/ansible/ansible-tower-samples.git
register: result
ignore_errors: True
- name: Delete the Project
- name: Delete the Project1
project:
name: "{{ proj1 }}"
organization: Default
state: absent
scm_type: git
scm_url: https://github.com/ansible/ansible-tower-samples.git
register: result
ignore_errors: True
- name: Delete Credential1
credential:
@@ -256,9 +320,28 @@
organization: Default
credential_type: Red Hat Ansible Automation Platform
state: absent
ignore_errors: True
# Labels can not be deleted
- name: Delete an execution environment
execution_environment:
name: "{{ ee1 }}"
image: "junk"
state: absent
ignore_errors: True
- name: Delete instance groups
instance_group:
name: "{{ item }}"
state: absent
loop:
- "{{ ig1 }}"
- "{{ ig2 }}"
ignore_errors: True
- name: "Remove the organization"
organization:
name: "{{ org_name }}"
state: absent
register: result
ignore_errors: True

View File

@@ -20,6 +20,11 @@
project_inv: "AWX-Collection-tests-inventory_source-inv-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
project_inv_source: "AWX-Collection-tests-inventory_source-inv-source-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
github_webhook_credential_name: "AWX-Collection-tests-credential-webhook-{{ test_id }}_github"
ee1: "AWX-Collection-tests-workflow_job_template-ee1-{{ test_id }}"
label1: "AWX-Collection-tests-workflow_job_template-l1-{{ test_id }}"
label2: "AWX-Collection-tests-workflow_job_template-l2-{{ test_id }}"
ig1: "AWX-Collection-tests-workflow_job_template-ig1-{{ test_id }}"
ig2: "AWX-Collection-tests-workflow_job_template-ig2-{{ test_id }}"
- block:
- name: "Create a new organization"
@@ -181,6 +186,12 @@
playbook: hello_world.yml
job_type: run
state: present
ask_execution_environment_on_launch: true
ask_forks_on_launch: true
ask_instance_groups_on_launch: true
ask_timeout_on_launch: true
ask_job_slice_count_on_launch: true
ask_labels_on_launch: true
register: jt2_name_result
- assert:
@@ -198,6 +209,12 @@
state: present
survey_enabled: true
survey_spec: '{"spec": [{"index": 0, "question_name": "my question?", "default": "mydef", "variable": "myvar", "type": "text", "required": false}], "description": "test", "name": "test"}'
ask_execution_environment_on_launch: true
ask_forks_on_launch: true
ask_instance_groups_on_launch: true
ask_timeout_on_launch: true
ask_job_slice_count_on_launch: true
ask_labels_on_launch: true
register: result
- assert:
@@ -255,6 +272,26 @@
that:
- "result is changed"
- name: Create labels
label:
name: "{{ item }}"
organization: "{{ org_name }}"
loop:
- "{{ label1 }}"
- "{{ label2 }}"
- name: Create an execution environment
execution_environment:
name: "{{ ee1 }}"
image: "junk"
- name: Create instance groups
instance_group:
name: "{{ item }}"
loop:
- "{{ ig1 }}"
- "{{ ig2 }}"
# Node actions do what the schema command used to do
- name: Create leaf node
workflow_job_template_node:
@@ -262,6 +299,39 @@
unified_job_template: "{{ jt2_name }}"
lookup_organization: "{{ org_name }}"
workflow: "{{ wfjt_name }}"
execution_environment: "{{ ee1 }}"
forks: 12
instance_groups:
- "{{ ig1 }}"
- "{{ ig2 }}"
job_slice_count: 2
labels:
- "{{ label1 }}"
- "{{ label2 }}"
timeout: 23
register: results
- assert:
that:
- "results is changed"
- name: Update prompts on leaf node
workflow_job_template_node:
identifier: leaf
unified_job_template: "{{ jt2_name }}"
lookup_organization: "{{ org_name }}"
workflow: "{{ wfjt_name }}"
execution_environment: ""
forks: 1
instance_groups: []
job_slice_count: 1
labels: []
timeout: 10
register: results
- assert:
that:
- "results is changed"
- name: Create root node
workflow_job_template_node:
@@ -815,6 +885,24 @@
state: absent
ignore_errors: True
# Labels can not be deleted
- name: Delete an execution environment
execution_environment:
name: "{{ ee1 }}"
image: "junk"
state: absent
ignore_errors: True
- name: Delete instance groups
instance_group:
name: "{{ item }}"
state: absent
loop:
- "{{ ig1 }}"
- "{{ ig2 }}"
ignore_errors: True
- name: "Remove the organization"
organization:
name: "{{ org_name }}"