Files
product-demos/roles/install_demo/tasks/main.yml
sean cavanaugh 9962eeaf66 syncing fix
thanks @sstanovnik
2021-06-07 16:16:21 -04:00

49 lines
1.5 KiB
YAML

---
- name: explicitly load vars under a subkey for reliable access
include_tasks: load_vars.yml
- name: set facts from role vars
set_fact:
demo_list: "{{ job_template_definitions|dict2items|map(attribute='key')|list }}"
full_demo_info: "{{ job_template_definitions|dict2items }}"
- name: provide info to terminal window
debug:
msg:
- "install {{ demo }} on {{ my_tower_host }}"
- "total demos: {{ demo_list | length }}"
- "available demos are: {{ demo_list }}"
- name: make sure demo is a valid demo
assert:
that:
- demo is defined
- demo in demo_list or demo == "all"
msg:
- "demo must be defined and be one of: {{ demo_list }}"
- "full list can be found on https://github.com/ansible/product-demos"
- name: setup public cloud credentials
include_tasks: "{{item}}"
with_first_found:
- "{{role_path}}/tasks/{{public_cloud}}.yml"
- "{{role_path}}/tasks/unsupported_cloud.yml"
- name: install all job templates
include_tasks: job_template_loop.yml
loop: "{{ full_demo_info }}"
when: demo == "all"
- name: install single job template
include_tasks: job_template.yml
when:
- demo != "all"
- job_template_definitions[demo].workflow is not defined or not job_template_definitions[demo].workflow
- name: install single workflow
include_tasks: workflow.yml
when:
- demo != "all"
- job_template_definitions[demo].workflow is defined
- job_template_definitions[demo].workflow