Documentation

14. Projects

A Project is a logical collection of Ansible playbooks, represented in Tower.

You can manage playbooks and playbook directories by either placing them manually under the Project Base Path on your Tower server, or by placing your playbooks into a source code management (SCM) system supported by Tower, including Git, Subversion, Mercurial, and Red Hat Insights. To create a Red Hat Insights project, refer to Setting up an Insights Project.

Note

By default, the Project Base Path is /var/lib/awx/projects, but this may have been modified by the Tower administrator. It is configured in /etc/tower/conf.d/custom.py. Use caution when editing this file, as incorrect settings can disable your installation.

This menu displays the list of the projects that are currently available. The default view is collapsed (Compact) with project name and its status, but you can expand to see more information. You can sort this list by various criteria, and perform a search to filter the projects of interest.

Projects - home with example project

_images/projects-list-all-expanded.png

For each project listed, you can get the latest SCM revision (refresh), copy the project attributes (copy), or delete (delete-icon) the project, using the respective icons next to each project.

Status indicates the state of the project and may be one of the following (note that you can also filter your view by specific status types):

  • Pending - The source control update has been created, but not queued or started yet. Any job (not just source control updates) will stay in pending until it’s actually ready to be run by the system. Reasons for it not being ready because it has dependencies that are currently running so it has to wait until they are done, or there is not enough capacity to run in the locations it is configured to.

  • Waiting - The source control update is in the queue waiting to be executed.

  • Running - The source control update is currently in progress.

  • Successful - The last source control update for this project succeeded.

  • Failed - The last source control update for this project failed.

  • Error - The last source control update job failed to run at all. (To be deprecated.)

  • Canceled - The last source control update for the project was canceled.

  • Never updated - The project is configured for source control, but has never been updated.

  • OK - The project is not configured for source control, and is correctly in place. (To be deprecated.)

  • Missing - Projects are absent from the project base path of /var/lib/awx/projects (applicable for manual or source control managed projects).

Note

Projects of credential type Manual cannot update or schedule source control-based actions without being reconfigured as an SCM type credential.

Note

If deleting items that are used by other work items, a message opens listing the items are affected by the deletion and prompts you to confirm the deletion. Some screens will contain items that are invalid or previously deleted, so they will fail to run. Below is an example of such a message:

_images/warning-deletion-dependencies.png

14.1. Add a new project

To create a new project:

  1. Click the add button, which launches the Create Project window.

Projects - create new project

  1. Enter the appropriate details into the following required fields:

  • Name

  • Description (optional)

  • Organization - A project must have at least one organization. Pick one organization now to create the project, and then after the project is created you can add additional organizations.

  • Ansible Environment (optional) - Select from the drop-down menu list a custom virtual environment on which to run this project. This field is only present if custom environments were previously created. See Using virtualenv with Ansible Tower in the Ansible Tower Upgrade and Migration Guide.

  • SCM Type - Select from the drop-down menu list an SCM type associated with this project. The options in the subsequent section become available depend on the type you choose. Refer to Manage playbooks manually and Manage playbooks using Source Control in the subsequent sections for more detail.

Note

If adding a manual project, each project path inside of the project root folder can only be assigned to one project. If you receive the following message, ensure that you have not already assigned the project path to an existing project:

All of the project paths have been assigned to existing projects, or there are no directories found in the base path. You will need to add a project path before creating a new project.

  1. Click Save when done.

14.1.1. Manage playbooks manually

  • Create one or more directories to store playbooks under the Project Base Path (for example, /var/lib/awx/projects/)

  • Create or copy playbook files into the playbook directory.

  • Ensure that the playbook directory and files are owned by the same UNIX user and group that the Tower service runs as.

  • Ensure that the permissions are appropriate for the playbook directories and files.

If you have trouble adding a project path, check the permissions and SELinux context settings for the project directory and files.

Warning

If you have not added any Ansible playbook directories to the base project path, you will receive the following message from Tower:

Projects - create new warning

Correct this issue by creating the appropriate playbook directories and checking out playbooks from your SCM or otherwise copying playbooks into the appropriate playbook directories.

14.1.2. Manage playbooks using Source Control

Note

By default, Ansible Tower has a system-wide setting that allows roles to be dynamically downloaded from a requirements.yml file for SCM projects. You may turn off this setting in the Jobs tab of the Settings (settings) menu by switching the Enable Role Download toggle button to OFF.

_images/configure-tower-jobs-download-roles.png
  1. Select the appropriate option from the SCM Type drop-down menu list.

Projects - create SCM project

  1. Enter the appropriate details into the following fields:

  • SCM URL - See an example in the help help text.

  • SCM Branch/Tag/Commit - Optionally enter the SCM branch, tags, commit hashes, arbitrary refs, or revision number (if applicable) from the source control (Git, Subversion, or Mercurial) to checkout. Some commit hashes and refs may not be available unless you also provide a custom refspec in the next field.

  • SCM Refspec - This field is an option specific to git source control and only advanced users familiar and comfortable with git should specify which references to download from the remote repository. For more detail, see job branch overriding.

  • SCM Credential - If authentication is required, select the appropriate SCM credential

  • SCM Update Options:

  • Clean - Removes any local modifications prior to performing an update.

  • Delete on Update - Deletes the local repository in its entirety prior to performing an update. Depending on the size of the repository this may significantly increase the amount of time required to complete an update.

  • Update Revision on Launch - Updates the revision of the project to the current revision in the remote source control. To avoid job overflows if jobs are spawned faster than the project can sync, selecting this allows you to configure a Cache Timeout to cache prior project syncs for a certain number of seconds.

  • Allow Branch Override - Allows a job template that uses this project to launch with a specified SCM branch or revision other than that of the project’s. For more detail, see job branch overriding.

_images/projects-create-scm-project-branch-override-checked.png
  1. Click Save to save your project.

Tip

Using a GitHub link offers an easy way to use a playbook. To help get you started, use the helloworld.yml file available at: https://github.com/ansible/tower-example.git

This link offers a very similar playbook to the one created manually in the instructions found in the Ansible Tower Quick Start Guide. Using it will not alter or harm your system in anyway.

14.1.2.1. Updating projects from source control

  1. Update an existing SCM-based project by selecting the project and clicking the update button.

Note

Please note that immediately after adding a project setup to use source control, a “Sync” starts that fetches the project details from the configured source control.

projects - list all

  1. Click on the dot under Status (far left, beside the name of the Project) to get further details about the update process.

Project - update status

14.2. Work with Permissions

The set of Permissions assigned to this project (role-based access controls) that provide the ability to read, modify, and administer projects, inventories, job templates, and other Tower elements are Privileges.

You can access the project permissions via the Permissions tab next to the Details tab. This screen displays a list of users that currently have permissions to this project. The list may be sorted and searched by User, Role, or Team Role.

Projects - permissions list for example project

14.2.1. Add Permissions

The Permissions tab allows you to review, grant, edit, and remove associated permissions for users as well as team members. To assign permissions to a particular user for this resource:

  1. Click the Permissions tab.

  2. Click the add button to open the Add Users/Teams window.

Add Permissions Form
  1. Specify the users or teams that will have access then assign them specific roles:

  1. Click to select one or multiple check boxes beside the name(s) of the user(s) or team(s) to select them.

Note

You can select multiple users and teams at the same time by navigating between the Users and Teams tabs without saving.

After selections are made, the window expands to allow you to select a role from the drop-down menu list for each user or team you chose.

Roles Assignment for Selected Users

The example above shows options associated with inventories. Different resources have different options available:

  • Admin allows read, run, and edit privileges (applies to all resources)

  • Use allows use of a resource in a job template (applies all resources except job templates)

  • Update allows updating of project via the SCM Update (applies to projects and inventories)

  • Ad Hoc allows use of Ad Hoc commands (applies to inventories)

  • Execute allows launching of a job template (applies to job templates)

  • Read allows view-only access (applies to all resources)

Tip

Use the Key button in the roles selection pane to display a description of each of the roles. For more information, refer to the Roles section of this guide.

  1. Select the role to apply to the selected user or team.

Note

You can assign roles to multiple users and teams by navigating between the Users and Teams tabs without saving.

Add Permissions - Examples of users and teams selected
  1. Review your role assignments for each user and team.

Add Permissions - Examples of roles applied
  1. Click Save when done, and the Add Users/Teams window closes to display the updated roles assigned for each user and team.

    Permissions tab with Role Assignments

To remove Permissions for a particular user, click the Disassociate (x) button next to its resource.

_images/permissions-disassociate.png

This launches a confirmation dialog, asking you to confirm the disassociation.

_images/permissions-disassociate-confirm.png

14.3. Work with Notifications

Clicking the Notifications tab allows you to review any notification integrations you have setup.

_images/projects-notifications-example-list.png

Use the toggles to enable or disable the notifications to use with your particular project. For more detail, see Enable and Disable Notifications.

If no notifications have been set up, click the NOTIFICATIONS link from inside the gray box to create a new notification.

_images/project-notifications-empty.png

Refer to Notification Types for additional details on configuring various notification types.

14.4. Work with Job Templates

Clicking on Job Templates allows you to add and review any job templates or workflow templates associated with this project. Click Expanded to view details about each template, including the statuses of the jobs that ran using that template, and other useful information. You can sort this list by various criteria, and perform a search to filter the templates of interest.

_images/projects-templates-example-list.png

From this view, you can also launch (launch), copy (copy), or delete (delete-icon) the template configuration. Note, the example above shows the expanded view.

14.5. Work with Schedules

Clicking on Schedules allows you to review any schedules set up for this project.

_images/projects-schedules-example-list.png

14.5.1. Schedule a Project

To schedule a project run, click the Schedules tab.

  • If schedules are already set up; review, edit, or enable/disable your schedule preferences.

  • If schedules have not been set up, refer to Schedules for more information.

14.6. Ansible Galaxy Support

At the end of a Project update, Tower searches for a file called requirements.yml in the roles directory, located at <project-top-level-directory>/roles/requirements.yml. If this file is found, the following command automatically runs:

ansible-galaxy install -r roles/requirements.yml -p <job private directory>/requirements_roles -vvv

This file allows you to reference Galaxy roles or roles within other repositories which can be checked out in conjunction with your own project. The addition of this Ansible Galaxy support eliminates the need to create git submodules for achieving this result. Given that SCM projects (along with roles/collections) are pulled into and executed from a private job environment, a <private job directory> specific to the project within /tmp is created by default. However, you can specify another Job Execution Path based on your environment in the Jobs Settings tab of the Configure Tower window:

_images/configure-tower-jobs-execution-path.png

For more information and examples on the syntax of the requirements.yml file, refer to the role requirements section in the Ansible documentation.

If there are any directories that should specifically be exposed, you can specify those in the Configure Tower screen in the Paths to Expose to Isolated Jobs or by updating the following entry in the settings file:

AWX_PROOT_SHOW_PATHS = ['/list/of/', '/paths']

Note

The primary file you may want to add to AWX_PROOT_SHOW_PATHS is /var/lib/awx/.ssh, if your playbooks need to use keys or settings defined there.

If you made changes in the settings file, be sure to restart services with the ansible-tower-service restart command after your changes have been saved.

In the Tower User Interface, you can configure these settings in the Jobs settings window. Click the (tooltips) icon in each of the fields for further detail.

_images/configure-tower-jobs-galaxy-options.png

14.7. Collections Support

Tower supports project-specific Ansible collections in job runs. If you specify a collections requirements file in the SCM at collections/requirements.yml, Tower will install collections in that file in the implicit project sync before a job run. To specify a collections requirement:

ansible-galaxy collection install -r requirements.yml -p <job tmp location>

Note

Starting with Ansible Tower 3.6, the project folder will be copied for each job run. This allows playbooks to make local changes to the source tree for convenience, such as creating temporary files, without the possibility of interference with other jobs.

For more information, refer to Using Collections.