1

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?

β.εηοιτ.βε
  • 33,893
  • 13
  • 69
  • 83
Zee
  • 13
  • 2

2 Answers2

0

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

U880D
  • 8,601
  • 6
  • 24
  • 40
  • It looks like we already use or consider using all of above mentioned mechanisms. While it's true that teams will help to manage large number of workflows, its not perfect as developers will have to by definition see all of them. I hoped that maybe to least custom views in dashboard would be possible? – Zee Feb 10 '22 at 10:07
  • @Zee, currently there are no Custom [Views](https://docs.ansible.com/ansible-tower/latest/html/userguide/main_menu.html#my-view). "_as developers will have to by definition see all of them_", that depends how the developers are organized, but mostly I agree, as at least admin teams will run into the same issue if not using different accounts for different tasks. – U880D Feb 10 '22 at 10:36
  • @Zee, if different accounts for different roles and tasks are not suitable, Structured Naming Convention and Annotation might be an option. I am using that approach too because of the same "problem" you like to address. The names are structured like `LC_OS_DEP_ROLE - TASK - OPTION`, the search is very fast and I just need to address what I like to do, in example `check` or `update`. With a search parameter like `WIN con test` only a role task for Windows connection tests will pop up, so it will "feels like" an CLI. – U880D Feb 10 '22 at 10:43
  • I agree, with strict naming convention enforcement we can deal with large number of job templates. At least now we know that there is no other widely accepted standard to manage JT's and WT's – Zee Feb 13 '22 at 11:52
0

Labels are too basic to emulate a "templates hierarchy". Let's say you have pages of Templates and some have labels "ad" & "set" and others have "ad" & "get". You can search Templates with Labels "ad" or "get" or "set" but you can't search for Templates with Labels "ad" AND "get". Your only choice is some sort of naming standard (that can include the "/" character) as a pseudo hierarchy.

Kym
  • 1