ansible/roles/openshift/job/tasks/main.yml
Ryan Lerch 3c41882bb0 ansiblelint fixes - fqcn[action-core] - shell to ansible.builtin.shell
Replaces references to shell: with ansible.builtin.shell

Signed-off-by: Ryan Lerch <rlerch@redhat.com>
2025-01-15 11:29:10 +10:00

31 lines
1.1 KiB
YAML

---
- name: Validate the job name {{ job_name }}
assert:
that:
- job_name is defined
fail_msg: "The 'job_name' variable is not defined"
- name: Validate the command {{ job_command }}
assert:
that:
- job_command is defined
fail_msg: "The 'job_command' variable is not defined"
- name: Copy job template to a temporary file
template:
src: "{{roles_path}}/openshift-apps/{{job_app}}/templates/{{job_template}}"
dest: "/etc/openshift_apps/{{job_app}}/job-{{job_name}}.yml"
- name: Delete previous job (if any)
ansible.builtin.shell: oc -n {{os_app}} delete --ignore-not-found=true -f /etc/openshift_apps/{{job_app}}/job-{{job_name}}.yml
- name: Start job
ansible.builtin.shell: oc -n {{os_app}} create -f /etc/openshift_apps/{{job_app}}/job-{{job_name}}.yml
- debug:
msg: "Job started. You can watch the logs with: oc -n {{os_app}} logs -f job/job-{{job_name}}"
- debug:
msg: "You can cancel it with: oc -n {{os_app}} delete job/job-{{job_name}}"
- name: Wait for job to complete
ansible.builtin.shell: oc -n {{os_app}} wait job/job-{{job_name}} --for condition=complete