Directory Layout

Instructions for configuring File Type Patterns up to OrchidE 2022.1.4.0. For newer version there is a simplified configuration Ansible Folder Mapping.

To recognize Ansible files, OrchidE needs two basic settings:

  • the root folders where the playbooks, roles and inventories are located.
  • a pattern set to recognize if it is a playbook, task or variable file

Root-Folders

The root folders are configured in the settings under File | Settings | Languages & Frameworks | OrchidE | Ansible Folder Mapping.

If an IntelliJ project consists of only one Ansible role, i.e. the tasks, handlers, defaults, … folders are directly in the IntelliJ root folder, OrchidE calls it a ‘Single Ansible role project’.

For a ‘Single Ansible role project’ the checkbox “Single Ansible role project” above the section Role Root Folders needs to be selected.

This will use the IntelliJ project folder as the root folder for the role and default pattern sets regardless of the settings in “File Type Patterns”.

The molecule folder is currently not automatically supported in the ‘Single Ansible role project’. To detect files in molecule folders, custom patterns for playbooks and tasks are required.

Pattern sets

The default pattern to recognize playbooks, roles and inventory variables files are configured for the following layout:

  project
  |-- inventory
  |   |-- hosts
  |   |-- group_vars
  |   |   |-- webservers
  |   |   |   |-- default.yml
  |-- playbooks
  |   |-- webservers
  |   |   -- main.yml  
  |-- roles
  |   |-- webserver
  |   |   |-- tasks
  |   |   |   |-- main.yml

Alternatively, playbooks can also be stored directly in the playbooks folder.

Additional patterns for different directory structures can be defined via the settings for the “File Type Pattern”.

(File | Settings | Languages & Frameworks | OrchidE | File Type Patterns)

Settings dialog of patterns for Ansible file recognition

Meaning of the Ansible Types:

Playbook
Standard type for the detection of playbooks. With this type the file name of a playbook file is interpreted as playbook name (for use in navigation)
PlaybookFolder
Detection of playbook files within a subfolder. With this type the parent folder of a playbook file is used as playbook name. This can be used to create a categorization of playbooks (playbook name is used for navigation)
Task
Type for the recognition of files containing tasks. For splitting playbooks when no roles are used (include_tasks). Do not use this type for roles.
RoleTask
Type for tasks and handlers in roles
RoleVariable
Type for defaults und vars file in roles
Note: Patterns of this type must explicitly apply to a specific role. For this, use the placeholder “%s” to match the role name.

Example:

|-- roles
  |   |-- webserver
  |   |   |-- defaults
  |   |   |   |-- main.yml

Matching pattern:

.*/roles/%s/defaults/.*\.ya?ml

Variable
Generic type for all files containing Ansible variables (role vars/defaults, host vars, group vars, included files). With this type, patterns for the role variables must be included again.

File Type Pattern Reset Configuration

The OrchidE plugin default settings can be restored via the toolbar button (Reset Button).