How to Install Ansible AWX on Linux | SysAdmin Tutorial
When working to automate our server management tasks at IOFLOOD, we have exprimented with installing AWX. When configured properly AWX, an open-source web-based automation platform, provides a graphical interface for managing Ansible playbooks, inventories, and job scheduling. To assist our dedicated hosting customers and fellow developers looking to automate their IT operations, we’ve formulated this article to provide a comprehensive tutorial on installing AWX on Linux.
In this tutorial, we will guide you on how to install the AWX
command on your Linux system. We will show you methods for both APT and YUM-based distributions, delve into compiling AWX
from source, installing a specific version, and finally, how to use the AWX
command and ensure it’s installed correctly.
So, let’s dive in and begin installing AWX
on your Linux system!
TL;DR: How Do I Install AWX on Linux?
Install AWX on Linux by first installing
Docker
andDocker Compose
. Clone the AWX repository from GitHub using git clonehttps://github.com/ansible/awx.git
. Navigate to the cloned directory and runansible-playbook -i inventory install.yml
to set up AWX. Access AWX via your web browser athttp://localhost
, using the default credentials provided during installation.
Here’s a quick example:
# Clone the AWX project from GitHub
git clone https://github.com/ansible/awx.git
# Navigate to the installer directory
cd awx/installer
# Run the installation playbook
ansible-playbook -i inventory install.yml
# Output:
# PLAY RECAP *********************************************************************
# localhost : ok=13 changed=2 unreachable=0 failed=0 skipped=106 rescued=0 ignored=0
This is just a basic way to install AWX on Linux, but there’s much more to learn about installing and using AWX. Continue reading for more detailed information and advanced usage scenarios.
Table of Contents
Getting Started with AWX on Linux
AWX is a powerful, open-source tool that provides a web-based user interface for Ansible. It’s designed to help you manage Ansible playbooks, inventories, and schedule jobs. If you’re dealing with complex IT infrastructure and looking for a way to automate your tasks, AWX is a perfect choice.
Installing AWX with Docker
Docker is one of the easiest ways to get AWX up and running on your Linux system. Here’s a step-by-step guide:
- Install Docker: If you haven’t installed Docker on your system, you’ll need to do that first. Here’s how you can install Docker on Ubuntu:
sudo apt-get update
sudo apt-get install docker.io
# Output:
# Reading package lists... Done
# Building dependency tree
# Reading state information... Done
# docker.io is already the newest version (20.10.2-0ubuntu1~20.04.2).
# 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
- Clone the AWX Project: Next, clone the AWX project from GitHub using the following command:
git clone https://github.com/ansible/awx.git
# Output:
# Cloning into 'awx'...
# remote: Enumerating objects: 165, done.
# remote: Counting objects: 100% (165/165), done.
# remote: Compressing objects: 100% (113/113), done.
# remote: Total 165 (delta 39), reused 143 (delta 26), pack-reused 0
# Receiving objects: 100% (165/165), 109.73 KiB | 2.44 MiB/s, done.
# Resolving deltas: 100% (39/39), done.
- Navigate to the Installer Directory: Change your directory to the installer directory of the cloned AWX project:
cd awx/installer
# Output:
# /home/user/awx/installer
- Run the Installation Playbook: Finally, run the installation playbook with the following command:
ansible-playbook -i inventory install.yml
# Output:
# PLAY RECAP *********************************************************************
# localhost : ok=13 changed=2 unreachable=0 failed=0 skipped=106 rescued=0 ignored=0
Congratulations! You have successfully installed AWX on your Linux system using Docker. In the following sections, we’ll explore more advanced installation methods and uses for AWX.
Installing AWX from Source Code
For those who prefer to build software from source, you can also install AWX this way. This method gives you more control over the version you install and allows you to review the code before installing.
Here’s how to get AWX from source:
# Clone the AWX repository
git clone https://github.com/ansible/awx.git
# Navigate to the AWX directory
cd awx
# Build AWX from source
make docker-compose-build
# Output:
# Successfully built 7e6e5fcd5aef
# Successfully tagged awx_devel:latest
Installing Different Versions of AWX
Installing from Source
To install a specific version of AWX from source, you can use git’s checkout command to switch to a specific tag. Here’s an example:
# Navigate to the AWX directory
cd awx
# List the available tags
git tag
# Checkout a specific tag
git checkout tags/1.0.1
# Build AWX from source
make docker-compose-build
# Output:
# Successfully built 7e6e5fcd5aef
# Successfully tagged awx_1.0.1:latest
Installing using Package Managers
AWX is also available through popular package managers like apt
and yum
. Here’s how to install a specific version using apt
:
# Update the package lists
sudo apt-get update
# Install a specific version of AWX
sudo apt-get install awx=1.0.1
# Output:
# Reading package lists... Done
# Building dependency tree
# Reading state information... Done
# E: Version '1.0.1' for 'awx' was not found
And here’s how to do it using yum
:
# Update the package lists
sudo yum update
# Install a specific version of AWX
sudo yum install awx-1.0.1
# Output:
# Loaded plugins: fastestmirror
# Loading mirror speeds from cached hostfile
# No package awx-1.0.1 available.
# Error: Nothing to do
Version Comparison
Different versions of AWX come with different features and compatibilities. Here’s a brief comparison:
Version | Key Features | Compatibility |
---|---|---|
1.0.1 | Initial release | Ansible 2.4 |
1.0.2 | Bug fixes | Ansible 2.4 |
1.0.3 | Improved scaling | Ansible 2.4 |
1.0.4 | New features | Ansible 2.4 |
Using AWX and Verifying Installation
How to Use AWX
Once you’ve installed AWX, you can start using it to manage your Ansible projects. Here’s a basic example of how to run a playbook:
awx playbook run example.yml
# Output:
# PLAY RECAP *********************************************************************
# localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Verifying the Installation
You can verify that AWX is installed and working correctly by checking its version:
awx --version
# Output:
# awx 1.0.1
This command should return the version number of the AWX you installed. If it returns an error, there might be something wrong with your installation.
Exploring Alternatives to AWX
While AWX is a powerful tool for managing Ansible projects, it’s not the only one out there. Let’s take a look at a couple of alternatives: Ansible Tower and Rundeck.
Ansible Tower: The Commercial Version
Ansible Tower is the commercial version of AWX, offering additional features and support. It’s a great choice for businesses that require enterprise-level solutions.
# Install Ansible Tower
wget https://releases.ansible.com/ansible-tower/setup/ansible-tower-setup-latest.tar.gz
tar xvfz ansible-tower-setup-latest.tar.gz
cd ansible-tower-setup-*/
./setup.sh
# Output:
# Setup completed successfully!
Ansible Tower offers features such as role-based access control, job scheduling, and graphical inventory management. However, it comes with a cost, which might not be suitable for individual users or small teams.
Rundeck: An Open Source Alternative
Rundeck is another open-source tool that you can use to manage your Ansible projects. It’s more of a general-purpose job scheduler and runbook automation tool, but it integrates well with Ansible.
# Install Rundeck
wget https://dl.bintray.com/rundeck/rundeck-rpm/rundeck-3.3.4-20200908.noarch.rpm
rpm -Uvh rundeck-3.3.4-20200908.noarch.rpm
# Output:
# Preparing... ################################# [100%]
# Updating / installing...
# 1:rundeck-3.3.4-20200908 ################################# [100%]
Rundeck offers features like access control, workflow building, scheduling, and logging. It’s a good choice if you’re looking for a tool that can handle more than just Ansible projects.
Comparison of AWX, Ansible Tower, and Rundeck
Tool | Open Source | Enterprise Support | Role-Based Access Control | Job Scheduling |
---|---|---|---|---|
AWX | Yes | No | Yes | Yes |
Ansible Tower | No | Yes | Yes | Yes |
Rundeck | Yes | Yes (Rundeck Enterprise) | Yes | Yes |
In conclusion, while AWX is a great tool for managing Ansible projects, it’s not the only option out there. Depending on your specific needs, you might find that Ansible Tower or Rundeck is a better fit for you.
Troubleshooting AWX Install Issues
Like any software installation, installing AWX on Linux can sometimes present challenges. Here, we’ll cover common issues you might encounter and how to overcome them.
Docker Not Found Error
If Docker is not installed or not running, you might encounter an error message like this when trying to install AWX:
# Run the installation playbook
ansible-playbook -i inventory install.yml
# Output:
# fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import docker or docker-py - cannot import name 'NotFound'. Try `pip install docker` or `pip install docker-py` (Python 2.6)"}
To resolve this issue, ensure that Docker is installed and running on your system. You can check its status with the following command:
sudo systemctl status docker
# Output:
# docker.service - Docker Application Container Engine
# Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
# Active: active (running) since Tue 2022-03-22 09:33:42 UTC; 2 days ago
AWX Web Interface Not Loading
After installing AWX, you might find that the web interface is not loading. This could be due to various reasons, such as the AWX services not running or network issues.
You can check the status of the AWX services with the following command:
docker ps
# Output:
# CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
# d4c6b77b7ab3 ansible/awx:17.1.0 "tini -- /bin/sh -c …" 2 days ago Up 2 days 8052/tcp, 0.0.0.0:80->8052/tcp, :::80->8052/tcp awx_web
# 7a9485f8e8e4 ansible/awx:17.1.0 "tini -- /bin/sh -c …" 2 days ago Up 2 days 8052/tcp awx_task
If the services are not running, you can start them with the following command:
docker start awx_web awx_task
# Output:
# awx_web
# awx_task
Considerations
While installing AWX, consider the following:
- System Requirements: Ensure your system meets the minimum requirements for AWX. This includes having at least 4GB of memory and 20GB of disk space.
- Network Configuration: Make sure your network is correctly configured to allow AWX to communicate with other services.
- Security: Secure your AWX installation by setting strong passwords and limiting access to the AWX web interface.
By keeping these considerations in mind and knowing how to troubleshoot common issues, you can ensure a smooth AWX installation experience.
Role of AWX in Ansible Projects
AWX is an open-source community project that provides a web-based user interface, REST API, and task engine for Ansible. It’s the upstream project for Ansible Tower, a commercial product by Red Hat.
# Check AWX version
awx --version
# Output:
# awx 17.1.0
In the above command, we’re checking the version of AWX installed on our system. This is a simple but essential command to verify that AWX is installed correctly and to identify the version we’re running.
The Importance of AWX in Ansible Projects
AWX plays a crucial role in managing Ansible projects by providing a visual dashboard, access control, job scheduling, integrated notifications, and graphical inventory management. With AWX, you can manage and track your Ansible projects in a more organized and efficient way.
The Significance of Automation in System Administration
In the realm of system administration, automation is a game-changer. It helps eliminate manual errors, enhances productivity, and accelerates processes. Automation tools like AWX make it easier to manage complex tasks and workflows, leading to more reliable and efficient system administration.
# Example of an automated task in AWX
awx job_templates create --name 'My Job Template' --project 'My Project' --playbook 'my_playbook.yml'
# Output:
# Resource changed.
# === ======================= =======
# id name type
# === ======================= =======
# 42 My Job Template job_template
In this example, we’re creating a new job template in AWX. A job template is a definition and set of parameters for running an Ansible job. Job templates allow you to execute jobs against inventory hosts with predefined parameters, which is a key aspect of automation in AWX.
In conclusion, understanding AWX and its role in Ansible project management is essential for efficient and effective system administration. Coupled with the power of automation, AWX can significantly streamline your system administration tasks.
AWX in DevOps and Automation
AWX, with its robust features and functionality, plays a significant role in the world of DevOps and automation. It provides a platform to manage and control your Ansible projects, offering a seamless way to automate tasks, manage inventories, and schedule jobs.
# Example of scheduling a job in AWX
awx job_templates schedule --name 'My Job Template' --every '1d'
# Output:
# Resource changed.
# === ======================= =======
# id name type
# === ======================= =======
# 42 My Job Template schedule
In the above example, we’re scheduling a job to run every day using AWX. This is a prime example of how AWX can be used for automation in a DevOps environment.
Exploring Ansible Playbooks and Roles
Beyond AWX, it’s worth exploring related concepts such as Ansible playbooks and roles. Playbooks are the files where Ansible code is written, and roles are ways to automatically load certain vars_files, tasks, and handlers based on a known file structure.
# Example of a simple Ansible playbook
---
- hosts: webservers
tasks:
- name: ensure apache is at the latest version
yum:
name: httpd
state: latest
# Output:
# PLAY [webservers] *********************************************************
# TASK [setup] ***************************************************************
# ok: [webserver1]
# TASK [ensure apache is at the latest version] ******************************
# changed: [webserver1]
# PLAY RECAP *****************************************************************
# webserver1 : ok=2 changed=1 unreachable=0 failed=0
In this example, we’re using a simple Ansible playbook to ensure that Apache is at the latest version on our web servers. This is a basic example of how playbooks and roles can be used in Ansible.
Further Resources for Mastering AWX
To further your understanding of AWX and Ansible, here are a few resources that you might find helpful:
- Ansible Documentation: The official Ansible documentation is a comprehensive resource that covers everything you need to know about Ansible and AWX.
DevOps’ish: A weekly newsletter on the intersection of IT operations and software development.
The Phoenix Project: A novel about DevOps, it covers many principles of DevOps and Agile methodologies.
Recap: Install AWX Ansible Manager
In this comprehensive guide, we’ve delved into the process of installing AWX on Linux, an essential tool for managing your Ansible projects. AWX, with its web-based user interface, REST API, and task engine, offers a robust platform for automation and task management, making it a key player in the realm of DevOps and system administration.
We began with a basic installation of AWX using Docker, providing a quick and easy way to get AWX up and running on your Linux system. We then explored more advanced installation methods, such as building AWX from source and installing specific versions of AWX. These methods offer more control over your AWX installation, allowing you to tailor it to your specific needs.
Along the way, we tackled common issues that you might encounter when installing AWX, such as Docker not being found or the AWX web interface not loading. We provided solutions and workarounds for these issues, ensuring a smooth installation process. We also discussed important considerations for your AWX installation, such as system requirements, network configuration, and security.
Method | Pros | Cons |
---|---|---|
Docker Installation | Quick and Easy | Limited Control |
Source Installation | More Control | More Steps Involved |
Specific Version Installation | Control Over Version | More Complex |
We also ventured beyond AWX, looking at alternative tools for managing Ansible projects, such as Ansible Tower and Rundeck. While AWX is a powerful tool, these alternatives offer additional features and capabilities that might better suit your needs.
With this guide, we hope you’ve gained a deeper understanding of AWX and its role in Ansible project management. Armed with this knowledge, you’re well equipped to install AWX on Linux and leverage its capabilities for efficient and effective system administration. Happy automating!