Documentation

10. Setting up a Project

There are two ways to access a simple playbook for this Quick Start example–manually or by specifying a link from a Github repository.

Note

It is recommended that, whenever possible, you use source control to manage your playbooks. This type of best practice provides the ability to treat your infrastructure as code and is in line with DevOps ideals.

10.1. Using Github for Playbook Access

Linking a playbook from Github

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 below. Using it will not alter or harm your system in anyway.

Create the project

Using your web browser, create the new project by clicking on the Projects link at the top of the Tower Dashboard.

Projects - home

Click the plus button, then enter a Name and Description for the project.

The Project Base Path displays the value entered during the installation of Tower. You cannot edit it from this dialog. (Refer to the Administration Guide for more information on how to alter this value.)

Set the SCM Type Git.

Playbook Setup:

Under SCM URL, provide the Github address to the playbook. For the purposes of this Quick Start, ignore the SCM Branch, SCM Credential, and SCM Update Options input fields.

Projects - create git project form

Select Save and the new project displays.

Projects - index showing newly created project

10.2. Accessing a Manually Created Playbook

Creating a playbook

Using a command line console as the root user, create a subdirectory for your project on the Tower server filesystem, in which to store your Ansible playbooks for this project.

Make a new project directory by creating it on the Tower filesystem under the Project Base Path directory, located by default in “/var/lib/awx/projects/”. For this example, the directory is helloworld.

root@localhost:~$ mkdir /var/lib/awx/projects/helloworld

Next, use your preferred editor to create a simple Ansible playbook. Make a file called “helloworld.yml” inside of the directory you just created.

root@localhost:~$vi /var/lib/awx/projects/helloworld/helloworld.yml

The contents of the file are below:

---
- name: Hello World!
  hosts: all

  tasks:

  - name: Hello World!
    shell: echo "Hi! Tower is working!"

Please take note of the indentation as it plays an important role. Once saved, this playbook file can test Tower running a playbook against the host in the inventory.

Note

If you have trouble navigating to the directories mentioned above or creating the helloworld.yml file due to permissions, use sudo as you execute your commands if you do not have root access.

Create the project

Using your web browser, create the new project by clicking on the Projects link at the top of the Tower Dashboard.

Projects - home

Click the plus button, then enter a Name and Description for the project.

The Project Base Path displays the value entered during the installation of Tower. You cannot edit it from this dialog. (Refer to the Administration Guide for more information on how to alter this value.)

Set the SCM Type to Manual.

Playbook Setup:

For the Playbook Directory, select a value which corresponds to the subdirectory you created.

Projects - create manual project form

Warning

If the helloworld/ project directory and file are incorrectly created, and if the permissions are incorrect, you will encounter the following message:

Project Warning

Double check your settings and use the command chown -R awx against the project directory, if necessary. If SE Linux is enabled, check the directory and file context.

Select Save and the new project displays.

Projects - index showing newly created project