/ansible-workflow

An attempt to document Ansible Tower workflows as code

GNU General Public License v3.0GPL-3.0

Workflow test repo

This is my personal collection of Ansible Workflow examples. Of course, most these are recycled from other repositories.

Running this

The configure_tower.yml will configure your Ansible Tower instance to setup this repo as a Project and create the Job Templates and Workflow required for the demo documented here.

tower_hostname and tower_oauthtoken need to be provided as extra vars or Tower Credentials. Check out Creating an OAuth 2 token.

The Ansible Tower collection (or AWX) namespace needs to be referenced.

   hosts: localhost
   collections:
     - ansible.tower

The configuration details are loaded from the yml files in the vars folder.

   pre_tasks:
     - name: Include vars from vars directory
       include_vars:
         dir: ./vars
         extensions: ["yml"]

Finally the redhat_cop.tower_configuration collection send these to Ansible Tower. This includes projects, job_templates and workflows.

   roles:
       - {role: redhat_cop.tower_configuration.projects, when: tower_projects is defined}
       - {role: redhat_cop.tower_configuration.job_templates, when: tower_templates is defined}

Dependencies

All dependencies are included in the requirements.yml file. You can either use the AWX Collection awx.awx, which is the upstream community distribution available on Ansible Galaxy or the downstream supported Ansible Collection ansible.tower that is available on Automation Hub.

ansible-galaxy collection install -r collections/requirements.yml

Links