ansible-awxansible-tower

What would be the best approach to emulate "templates hierarchy"?


Ansible Tower does not offer directory hierarchy for templates and workflows.
How should we manage their growing number in a flat structure?

I know we could use labels, but their use seems a bit tedious and assume that users already knows label for template they look for. Are there any best practices which we could follow?


Solution

  • Ansible Tower does not offer directory hierarchy for templates and workflows.

    Right, according the documentation the Job Templates view is a list only.

    This list is sorted alphabetically by name, but you can sort by other criteria, or search by various fields and attributes of a template.

    If using Labels

    Labels can be used to group and filter job templates and completed jobs in the Tower display.

    are not helpful

    I know we could use labels, but their use seems a bit tedious and assume that users already knows label for template they look for.

    there might the possibility to introduce a structured Naming Convention for TEMPLATES / NAME.

    Since Job Templates are usually for automating administrative tasks like rollouts, updates, restarts, etc. you could have a structure there like DEP_ROLENAME_TASKNAME. This would also be possible for TEMPLATES DESCRIPTION. It is than easier to look them up via UI, as well REST API

    curl --silent -u "${ACCOUNT}:${PASSWORD}" https://${TOWER_URL}/api/v2/job_templates/?search=DEP_ROLENAME_TASKNAME | jq .
    

    A better approach might be to introduce Teams

    a subdivision of an organization with associated users, projects, credentials, and permissions. Teams provide a means to implement role-based access control schemes and delegate responsibilities across organizations.

    and Add Permission for certain Job Templates. A specific team or users can than only see Job Templates for tasks which they are supposed to do. There would be no need for lookup, searching and filtering anymore.

    Further reading