mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Initial version of tower_schedule
This commit is contained in:
committed by
beeankha
parent
420c75f76f
commit
0e1a2b899a
@@ -0,0 +1,103 @@
|
||||
---
|
||||
- name: Generate a random string for test
|
||||
set_fact:
|
||||
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
||||
|
||||
- name: generate random string for project
|
||||
set_fact:
|
||||
sched1: "AWX-Collection-tests-tower_schedule-sched1-{{ test_id }}"
|
||||
|
||||
# rrule:
|
||||
# description:
|
||||
# extra_data:
|
||||
# inventory:
|
||||
# scm_branch:
|
||||
# job_type:
|
||||
# job_tags:
|
||||
# skip_tags:
|
||||
# limit:
|
||||
# diff_mode:
|
||||
# verbosity:
|
||||
|
||||
- name: Try to create without an rrule
|
||||
tower_schedule:
|
||||
name: "{{ sched1 }}"
|
||||
state: present
|
||||
unified_job_template: "Demo Job Template"
|
||||
enabled: True
|
||||
register: result
|
||||
ignore_errors: True
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is failed
|
||||
- "'Unable to create schedule {{ sched1 }}' in result.msg"
|
||||
|
||||
- name: Create with options that the JT does not support
|
||||
tower_schedule:
|
||||
name: "{{ sched1 }}"
|
||||
state: present
|
||||
unified_job_template: "Demo Job Template"
|
||||
rrule: "DTSTART:20191219T130551Z RRULE:FREQ=WEEKLY;INTERVAL=1;COUNT=1"
|
||||
description: "This hopefully will not work"
|
||||
extra_data:
|
||||
some: var
|
||||
inventory: Demo Inventory
|
||||
scm_branch: asdf1234
|
||||
job_type: run
|
||||
job_tags: other_tags
|
||||
skip_tags: some_tags
|
||||
limit: node1
|
||||
diff_mode: True
|
||||
verbosity: 4
|
||||
enabled: True
|
||||
register: result
|
||||
ignore_errors: True
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is failed
|
||||
- "'Unable to create schedule {{ sched1 }}' in result.msg"
|
||||
|
||||
- name: Build a real schedule
|
||||
tower_schedule:
|
||||
name: "{{ sched1 }}"
|
||||
state: present
|
||||
unified_job_template: "Demo Job Template"
|
||||
rrule: "DTSTART:20191219T130551Z RRULE:FREQ=WEEKLY;INTERVAL=1;COUNT=1"
|
||||
register: result
|
||||
ignore_errors: True
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Rebuild the same scedule
|
||||
tower_schedule:
|
||||
name: "{{ sched1 }}"
|
||||
state: present
|
||||
unified_job_template: "Demo Job Template"
|
||||
rrule: "DTSTART:20191219T130551Z RRULE:FREQ=WEEKLY;INTERVAL=1;COUNT=1"
|
||||
register: result
|
||||
ignore_errors: True
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is not changed
|
||||
|
||||
- name: Disable a schedule
|
||||
tower_schedule:
|
||||
name: "{{ sched1 }}"
|
||||
state: present
|
||||
enabled: "False"
|
||||
register: result
|
||||
ignore_errors: True
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Delete the schedule
|
||||
tower_schedule:
|
||||
name: "{{ sched1 }}"
|
||||
state: absent
|
||||
Reference in New Issue
Block a user