syncing source to git

This commit is contained in:
ipvsean
2020-04-21 20:16:09 -04:00
parent cc30a3d5b0
commit 3239f2ee6a
34 changed files with 394 additions and 274 deletions

View File

@@ -1,51 +1,54 @@
---
- name: add tower project
tower_project:
name: "{{hostvars.localhost[demo].project.name}}"
description: "{{hostvars.localhost[demo].project.description}}"
organization: "{{hostvars.localhost[demo].project.organization}}"
scm_type: "{{hostvars.localhost[demo].project.scm_type}}"
scm_url: "{{hostvars.localhost[demo].project.scm_url}}"
tower_username: "{{my_tower_username}}"
tower_password: "{{my_tower_password}}"
tower_host: "{{my_tower_host}}"
validate_certs: no
name: "{{ vars[demo].project.name }}"
description: "{{ vars[demo].project.description }}"
organization: "{{ vars[demo].project.organization }}"
scm_type: "{{ vars[demo].project.scm_type }}"
scm_url: "{{ vars[demo].project.scm_url }}"
tower_username: "{{ my_tower_username }}"
tower_password: "{{ my_tower_password }}"
tower_host: "{{ my_tower_host }}"
validate_certs: false
- name: add single job template without survey
tower_job_template:
name: "{{hostvars.localhost[demo].name}}"
description: "{{hostvars.localhost[demo].description}}"
job_type: "{{hostvars.localhost[demo].job_type}}"
inventory: "{{hostvars.localhost[demo].inventory}}"
project: "{{hostvars.localhost[demo].project.name}}"
playbook: "{{hostvars.localhost[demo].playbook}}"
fact_caching_enabled: "{{hostvars.localhost[demo].fact_caching_enabled | default('no')}}"
credential: "{{hostvars.localhost[demo].credential}}"
survey_enabled: "{{hostvars.localhost[demo].survey_enabled}}"
tower_username: "{{my_tower_username}}"
tower_password: "{{my_tower_password}}"
tower_host: "{{my_tower_host}}"
validate_certs: no
name: "{{ vars[demo].name }}"
description: "{{ vars[demo].description }}"
job_type: "{{ vars[demo].job_type }}"
inventory: "{{ vars[demo].inventory}}"
project: "{{ vars[demo].project.name }}"
playbook: "{{ vars[demo].playbook }}"
fact_caching_enabled: "{{ vars[demo].fact_caching_enabled | default('false') }}"
credential: "{{ vars[demo].credential }}"
survey_enabled: "{{ vars[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 hostvars.localhost[demo].workshop_type
- not hostvars.localhost[demo].survey_enabled
- workshop_type in vars[demo].workshop_type
- not vars[demo].survey_enabled
register: add_project
until: add_project is not failed
retries: 5
- name: add single job template with survey
tower_job_template:
name: "{{hostvars.localhost[demo].name}}"
description: "{{hostvars.localhost[demo].description}}"
job_type: "{{hostvars.localhost[demo].job_type}}"
inventory: "{{hostvars.localhost[demo].inventory}}"
project: "{{hostvars.localhost[demo].project.name}}"
playbook: "{{hostvars.localhost[demo].playbook}}"
fact_caching_enabled: "{{hostvars.localhost[demo].fact_caching_enabled | default('no')}}"
credential: "{{hostvars.localhost[demo].credential}}"
survey_enabled: "{{hostvars.localhost[demo].survey_enabled}}"
survey_spec: "{{hostvars.localhost[demo].survey_spec}}"
tower_username: "{{my_tower_username}}"
tower_password: "{{my_tower_password}}"
tower_host: "{{my_tower_host}}"
validate_certs: no
name: "{{ vars[demo].name }}"
description: "{{ vars[demo].description }}"
job_type: "{{ vars[demo].job_type }}"
inventory: "{{ vars[demo].inventory}}"
project: "{{ vars[demo].project.name }}"
playbook: "{{ vars[demo].playbook }}"
fact_caching_enabled: "{{ vars[demo].fact_caching_enabled | default('false') }}"
credential: "{{ vars[demo].credential }}"
survey_enabled: "{{ vars[demo].survey_enabled }}"
survey_spec: "{{ vars[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 hostvars.localhost[demo].workshop_type
- hostvars.localhost[demo].survey_enabled
- workshop_type in vars[demo].workshop_type
- vars[demo].survey_enabled

View File

@@ -1,56 +1,64 @@
---
- name: block for job template (non-workflow)
- name: block for job template loop
block:
- name: add tower project
- name: "add tower project job_template_loop.yml"
tower_project:
name: "{{item.value.project.name}}"
description: "{{item.value.project.description}}"
organization: "{{item.value.project.organization}}"
scm_type: "{{item.value.project.scm_type}}"
scm_url: "{{item.value.project.scm_url}}"
tower_username: "{{my_tower_username}}"
tower_password: "{{my_tower_password}}"
tower_host: "{{my_tower_host}}"
validate_certs: no
name: "{{ item.value.project.name }}"
description: "{{ item.value.project.description }}"
organization: "{{ item.value.project.organization }}"
scm_type: "{{ item.value.project.scm_type }}"
scm_url: "{{ item.value.project.scm_url }}"
tower_username: "{{ my_tower_username }}"
tower_password: "{{ my_tower_password }}"
tower_host: "{{ my_tower_host }}"
validate_certs: false
when:
- workshop_type in item.value.workshop_type
- name: "add job template {{item.value.name}} without survey"
- name: "add job template {{ item.value.name }} without survey job_template_loop.yml"
tower_job_template:
name: "{{item.value.name}}"
description: "{{item.value.description}}"
job_type: "{{item.value.job_type}}"
inventory: "{{item.value.inventory}}"
project: "{{item.value.project.name}}"
playbook: "{{item.value.playbook}}"
fact_caching_enabled: "{{item.value.fact_caching_enabled | default('no')}}"
credential: "{{item.value.credential}}"
survey_enabled: "{{item.value.survey_enabled}}"
tower_username: "{{my_tower_username}}"
tower_password: "{{my_tower_password}}"
tower_host: "{{my_tower_host}}"
validate_certs: no
name: "{{ item.value.name }}"
description: "{{ item.value.description }}"
job_type: "{{ item.value.job_type }}"
inventory: "{{ item.value.inventory}}"
project: "{{ item.value.project.name }}"
playbook: "{{ item.value.playbook}}"
fact_caching_enabled: "{{ item.value.fact_caching_enabled | default('false')}}"
credential: "{{ item.value.credential }}"
survey_enabled: "{{ item.value.survey_enabled }}"
tower_username: "{{ my_tower_username }}"
tower_password: "{{ my_tower_password }}"
tower_host: "{{ my_tower_host }}"
validate_certs: false
when:
- workshop_type in item.value.workshop_type
- not item.value.survey_enabled
register: add_project
until: add_project is not failed
retries: 5
- name: "add job template {{item.value.name}} with survey"
- name: "add job template {{ item.value.name }} with survey"
tower_job_template:
name: "{{item.value.name}}"
description: "{{item.value.description}}"
job_type: "{{item.value.job_type}}"
inventory: "{{item.value.inventory}}"
project: "{{item.value.project.name}}"
playbook: "{{item.value.playbook}}"
fact_caching_enabled: "{{item.value.fact_caching_enabled | default('no')}}"
credential: "{{item.value.credential}}"
survey_enabled: "{{item.value.survey_enabled}}"
survey_spec: "{{item.value.survey_spec}}"
tower_username: "{{my_tower_username}}"
tower_password: "{{my_tower_password}}"
tower_host: "{{my_tower_host}}"
validate_certs: no
name: "{{ item.value.name }}"
description: "{{ item.value.description }}"
job_type: "{{ item.value.job_type }}"
inventory: "{{ item.value.inventory}}"
project: "{{ item.value.project.name }}"
playbook: "{{ item.value.playbook}}"
fact_caching_enabled: "{{ item.value.fact_caching_enabled | default('false') }}"
credential: "{{ item.value.credential }}"
survey_enabled: "{{ item.value.survey_enabled }}"
survey_spec: "{{ item.value.survey_spec}}"
tower_username: "{{ my_tower_username }}"
tower_password: "{{ my_tower_password }}"
tower_host: "{{ my_tower_host }}"
validate_certs: false
when:
- workshop_type in item.value.workshop_type
- item.value.survey_enabled
register: add_project
until: add_project is not failed
retries: 5
when:
- item.value.workflow is not defined or not item.value.workflow
@@ -59,3 +67,4 @@
when:
- item.value.workflow is defined
- item.value.workflow
- workshop_type in item.value.workshop_type

View File

@@ -1,22 +1,37 @@
---
- name: set facts from role vars
set_fact:
demo_list: "{{(dict(vars|dictsort|rejectattr('0', 'match', 'ansible_')|selectattr('1.name', 'defined'))|dict2items)|map(attribute='key')|list}}"
- name: provide info to terminal window
debug:
msg: "install {{demo}} on {{my_tower_host}}"
msg:
- "install {{ vars.demo }} on {{ my_tower_host }}"
- "available demos are: {{demo_list}}"
- name: make sure demo is a valid demo
assert:
that:
- vars.demo is defined
- vars.demo in demo_list or vars.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: install all job templates
include_tasks: job_template_loop.yml
loop: "{{dict(hostvars[inventory_hostname]|dictsort|rejectattr('0', 'match', 'ansible_')|selectattr('1.name', 'defined'))|dict2items}}"
loop: "{{ dict(vars|dictsort|rejectattr('0', 'match', 'ansible_')|selectattr('1.name', 'defined'))|dict2items }}"
when: demo == "all"
- name: install single job template
include_tasks: job_template.yml
when:
- demo != "all"
- hostvars[inventory_hostname][demo].workflow is not defined or not hostvars[inventory_hostname][demo].workflow
- vars[demo].workflow is not defined or not vars[demo].workflow
- name: install single workflow
include_tasks: workflow.yml
when:
- demo != "all"
- hostvars[inventory_hostname][demo].workflow is defined
- hostvars[inventory_hostname][demo].workflow
- vars[demo].workflow is defined
- vars[demo].workflow

View File

@@ -1,17 +1,17 @@
---
#these tasks will install a workflow
# these tasks will install a workflow
- name: "install all job templates in relation to workflow {{hostvars[inventory_hostname][demo].name}}"
- name: "install all job templates in relation to workflow {{ hostvars[inventory_hostname][demo].name }}"
include_tasks: add_job_template.yml
loop: "{{hostvars[inventory_hostname][demo].job_templates|dict2items}}"
loop: "{{ hostvars[inventory_hostname][demo].job_templates|dict2items }}"
- name: "install workflow template {{hostvars[inventory_hostname][demo].name}}"
- name: "install workflow template {{ hostvars[inventory_hostname][demo].name }}"
tower_workflow_template:
name: "{{hostvars[inventory_hostname][demo].name}}"
description: "{{hostvars[inventory_hostname][demo].description}}"
organization: "{{hostvars[inventory_hostname][demo].organization}}"
schema: "{{ hostvars[inventory_hostname][demo].schema}}"
tower_username: "{{my_tower_username}}"
tower_password: "{{my_tower_password}}"
tower_host: "{{my_tower_host}}"
validate_certs: no
name: "{{ hostvars[inventory_hostname][demo].name }}"
description: "{{ hostvars[inventory_hostname][demo].description }}"
organization: "{{ hostvars[inventory_hostname][demo].organization }}"
schema: "{{ hostvars[inventory_hostname][demo].schema }}"
tower_username: "{{ my_tower_username }}"
tower_password: "{{ my_tower_password }}"
tower_host: "{{ my_tower_host }}"
validate_certs: false

View File

@@ -1,15 +1,15 @@
---
- name: "INSIDE LOOP - install all job templates in relation to workflow {{item.value.name}}"
- name: "INSIDE LOOP - install all job templates in relation to workflow {{ item.value.name }}"
include_tasks: job_template_loop.yml
loop: "{{item.value.job_templates|dict2items}}"
loop: "{{ item.value.job_templates|dict2items}}"
- name: "INSIDE LOOP - install workflow template {{item.value.name}}"
- name: "INSIDE LOOP - install workflow template {{ item.value.name }}"
tower_workflow_template:
name: "{{item.value.name}}"
description: "{{item.value.description}}"
organization: "{{item.value.organization}}"
schema: "{{item.value.schema}}"
tower_username: "{{my_tower_username}}"
tower_password: "{{my_tower_password}}"
tower_host: "{{my_tower_host}}"
validate_certs: no
name: "{{ item.value.name }}"
description: "{{ item.value.description }}"
organization: "{{ item.value.organization }}"
schema: "{{ item.value.schema}}"
tower_username: "{{my_tower_username }}"
tower_password: "{{my_tower_password }}"
tower_host: "{{my_tower_host }}"
validate_certs: false