workflow test

This commit is contained in:
ipvsean
2020-03-10 12:28:40 -04:00
parent 3edd2cf161
commit e5447e6819
6 changed files with 118 additions and 3 deletions

View File

@@ -2,6 +2,12 @@
This project is **not** currently taking PRs (pull requests) or code contributions. This is currently a work in progress and not at a point that would make sense to take contributions. Please try to make PRs into [ansible-examples](https://github.com/ansible/ansible-examples) if you want to showcase Ansible Playbooks or roles.
# Converting Existing Workflows into ephemeral demos
There is no way in the Ansible Tower API to access the workflow schema at this time (March 2020). Please refer to the docs and use the awx-cli/tower-cli command to export existing Workflow schema: [https://github.com/ansible/tower-cli/blob/master/docs/source/cli_ref/usage/WORKFLOWS.rst](documentation).
The Workflow schema can be automated by using the [tower_workflow_template](https://docs.ansible.com/ansible/latest/modules/tower_workflow_template_module.html#parameter-schema) module to load Ansible Tower with an entire Workflow.
# Going Further
The following links will be helpful if you want to contribute code to the Ansible Workshops project, or any Ansible project:

View File

@@ -0,0 +1,82 @@
---
f5_bigip_workflow:
workflow: true
author: "Sean Cavanaugh"
name: "WORKFLOW - F5 BIG-IP"
description: 'Workflow for F5 BIG-IP to setup a VIP (Virtual IP) load balancer between two RHEL webservers'
organization: "Default"
workshop_type:
- f5
schema:
- job_template: "F5 - add nodes"
success:
- job_template: "F5 - add pool"
success:
- job_template: "F5 - add pool members"
success:
- job_template: "F5 - add virtual server"
job_templates:
f5_add_nodes:
name: "F5 - add nodes"
description: "add webserver nodes into F5 BIG-IP"
job_type: "run"
inventory: "Workshop Inventory"
playbook: "exercises/ansible_f5/1.2-add-node/bigip-node.yml"
credential: "Workshop Credential"
survey_enabled: no
project:
name: "Ansible Workshops Project"
description: "official workshops from Ansible"
organization: "Default"
scm_type: git
scm_url: "https://github.com/ansible/workshops"
workshop_type:
- f5
f5_add_pool:
name: "F5 - add pool"
description: "add webserver nodes into F5 BIG-IP"
job_type: "run"
inventory: "Workshop Inventory"
playbook: "exercises/ansible_f5/1.3-add-pool/bigip-pool.yml"
credential: "Workshop Credential"
survey_enabled: no
project:
name: "Ansible Workshops Project"
description: "official workshops from Ansible"
organization: "Default"
scm_type: git
scm_url: "https://github.com/ansible/workshops"
workshop_type:
- f5
f5_add_pool_members:
name: "F5 - add pool members"
description: "add webserver nodes into pool"
job_type: "run"
inventory: "Workshop Inventory"
playbook: "exercises/ansible_f5/1.4-add-pool-members/bigip-pool-members.yml"
credential: "Workshop Credential"
survey_enabled: no
project:
name: "Ansible Workshops Project"
description: "official workshops from Ansible"
organization: "Default"
scm_type: git
scm_url: "https://github.com/ansible/workshops"
workshop_type:
- f5
f5_add_vip:
name: "F5 - add virtual server"
description: "create VIP and add pool to virtual server"
job_type: "run"
inventory: "Workshop Inventory"
playbook: "exercises/ansible_f5/1.5-add-virtual-server/bigip-virtual-server.yml"
credential: "Workshop Credential"
survey_enabled: no
project:
name: "Ansible Workshops Project"
description: "official workshops from Ansible"
organization: "Default"
scm_type: git
scm_url: "https://github.com/ansible/workshops"
workshop_type:
- f5

View File

@@ -1,3 +1,4 @@
---
- name: add tower project
tower_project:
name: "{{item.value.project.name}}"

View File

@@ -10,4 +10,13 @@
- name: install single job template
include: single_job_template.yml
when: demo != "all"
when:
- demo != "all"
- hostvars[inventory_hostname][demo].workflow is undefined or not hostvars[inventory_hostname][demo].workflow
- name: install single workflow
include: workflow.yml
when:
- demo != "all"
- hostvars[inventory_hostname][demo].workflow is defined
- hostvars[inventory_hostname][demo].workflow

View File

@@ -1,3 +1,4 @@
---
- name: add tower project
tower_project:
name: "{{hostvars.localhost[demo].project.name}}"
@@ -26,7 +27,7 @@
tower_host: "{{my_tower_host}}"
validate_certs: no
when:
- workshop_type in item.value.workshop_type
- workshop_type in hostvars.localhost[demo].workshop_type
- not hostvars.localhost[demo].survey_enabled
- name: add single job template with survey
@@ -46,5 +47,5 @@
tower_host: "{{my_tower_host}}"
validate_certs: no
when:
- workshop_type in item.value.workshop_type
- workshop_type in hostvars.localhost[demo].workshop_type
- hostvars.localhost[demo].survey_enabled

View File

@@ -0,0 +1,16 @@
---
#these tasks will install a workflow
- name: install all job templates in relation to workflow
include: add_job_template.yml
loop: "{{hostvars[inventory_hostname][demo].job_templates|dict2items}}"
- 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