Files
product-demos/roles/install_demo/tasks/job_template.yml
Sašo Stanovnik 3188c5742f Remove the use of vars and hostvars wherever possible.
`vars` operates inconsistently in different combinations of
Ansible (full/base/core) and Python versions.

Variables are now instead explicitly loaded under a subkey, which also removes
the need for filtering and makes access more explicit and semantic.
2021-06-03 16:10:00 +02:00

72 lines
3.4 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 }}"
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 }}"
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