Files
product-demos/roles/install_demo/tasks/job_template.yml
2021-10-12 15:11:22 -04:00

74 lines
3.6 KiB
YAML

---
- name: add tower project
awx.awx.tower_project:
name: "{{ job_template_definitions[demo].project.name }}"
description: "{{ job_template_definitions[demo].project.description }}"
organization: "{{ job_template_definitions[demo].project.organization }}"
scm_type: "{{ job_template_definitions[demo].project.scm_type }}"
scm_url: "{{ job_template_definitions[demo].project.scm_url }}"
tower_username: "{{ my_tower_username }}"
tower_password: "{{ my_tower_password }}"
tower_host: "{{ my_tower_host }}"
validate_certs: false
- name: show values
debug:
msg:
- "name: {{ job_template_definitions[demo].name }}"
- "description: {{ job_template_definitions[demo].description }}"
- "job_type: {{ job_template_definitions[demo].job_type }}"
- "inventory: {{ job_template_definitions[demo].inventory }}"
- "project: {{ job_template_definitions[demo].project.name }}"
- "playbook: {{ job_template_definitions[demo].playbook }}"
- "fact_caching_enabled: {{ job_template_definitions[demo].fact_caching_enabled | default('false') }}"
- "credential: {{ job_template_definitions[demo].credential }}"
- "survey_enabled: {{ job_template_definitions[demo].survey_enabled | default('false') }}"
- name: add single job template without survey
awx.awx.tower_job_template:
name: "{{ job_template_definitions[demo].name }}"
description: "{{ job_template_definitions[demo].description }}"
job_type: "{{ job_template_definitions[demo].job_type }}"
inventory: "{{ job_template_definitions[demo].inventory }}"
project: "{{ job_template_definitions[demo].project.name }}"
playbook: "{{ job_template_definitions[demo].playbook }}"
execution_environment: "{{ job_template_definitions[demo].execution_environment }}"
fact_caching_enabled: "{{ job_template_definitions[demo].fact_caching_enabled | default('false') }}"
credential: "{{ job_template_definitions[demo].credential }}"
survey_enabled: "{{ job_template_definitions[demo].survey_enabled }}"
tower_username: "{{ my_tower_username }}"
tower_password: "{{ my_tower_password }}"
tower_host: "{{ my_tower_host }}"
validate_certs: false
when:
- workshop_type in job_template_definitions[demo].workshop_type
- not job_template_definitions[demo].survey_enabled
register: add_job_template
until: add_job_template is not failed
retries: 5
- name: add single job template with survey
awx.awx.tower_job_template:
name: "{{ job_template_definitions[demo].name }}"
description: "{{ job_template_definitions[demo].description }}"
job_type: "{{ job_template_definitions[demo].job_type }}"
inventory: "{{ job_template_definitions[demo].inventory }}"
project: "{{ job_template_definitions[demo].project.name }}"
playbook: "{{ job_template_definitions[demo].playbook }}"
execution_environment: "{{ job_template_definitions[demo].execution_environment }}"
fact_caching_enabled: "{{ job_template_definitions[demo].fact_caching_enabled | default('false') }}"
credential: "{{ job_template_definitions[demo].credential }}"
survey_enabled: "{{ job_template_definitions[demo].survey_enabled }}"
survey_spec: "{{ job_template_definitions[demo].survey_spec }}"
tower_username: "{{ my_tower_username }}"
tower_password: "{{ my_tower_password }}"
tower_host: "{{ my_tower_host }}"
validate_certs: false
when:
- workshop_type in job_template_definitions[demo].workshop_type
- job_template_definitions[demo].survey_enabled
register: add_job_template
until: add_job_template is not failed
retries: 5