Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Guide to starting to use AWX, the upstream of Red Hat Ansible Tower, on top of OpenShift

 

October 16, 2017
Erick Brito
Related topics:
DevOpsLinuxKubernetes
Related products:
Streams for Apache KafkaRed Hat OpenShiftRed Hat OpenShift Container Platform

Share:

    Introduction

    This is the first post in a series that shows how to use the new release of the community version of Red Hat Ansible Tower. In this post, we will start with the installation of AWX on top of OpenShift. In the next post, I'll show how to set a dynamic inventory to access the servers from AWS (EC2) and how to run a playbook to access our AWS EC2 inventory.

    For many of you, Ansible needs an introduction, however, for those not already familiar, Ansible is a tool that allows you to have infrastructure as a code. In many ways, it is similar to Chef or Puppet.

    The benefits of Ansible to adopt it are:

    1. It is human readable and very simple to understand.
    2. Code by convention: the structure of the projects follows a convention.
    3. To access the managed resources, you don't need an agent. Access is done with SSH.
    4. A motivated and growing Ansible community brings you almost every kind of module you can imagine, accessible at Ansible-Galaxy.
    5. A host inventory handles and defines the infrastructure.

    That last point is what makes Ansible Tower an Enterprise tool to enable Cloud Automation. Because cloud infrastructure is elastic, we need a host inventory that is dynamic. Ansible handles this with dynamic inventories in a very simple way. Moreover, plugins already exist to handle the big public cloud providers (AWS, GCP, Azure, OpenStack).

    An Ansible project is composed of code that defines the Playbook, the roles, and the tasks. Ansible Tower brings the Enterprise Level to have a Cloud Automation tool.

    Installation of AWX (upstream version of Ansible Tower)

    Pre-requirements

    1. As our target deployment is OpenShift, we should already have OpenShift installed. For this example, I used a local installation with $oc cluster up. You can learn how to install oc cluster up here.
    2. We should have also installed Ansible – I have installed the version 2.3.1.0, but you can install a newer version. You can review the directions on how to install Ansible here.

    Steps to Install AWX

    Clone the code from AWX (at the time this post the version comes from devel branch). You can review the steps to install it at gist install awx on openshift.

    mkdir Tower
    cd Tower/
    git clone https://github.com/ansible/awx.git 
    cd awx 
    cd installer/

    You have to edit the inventory file to configure the installation to be on OpenShift.

    -# openshift_host=127.0.0.1:8443 
    -# awx_openshift_project=awx 
    -# openshift_user=developer 
    -# awx_node_port=30083 
    + openshift_host=127.0.0.1:8443 
    + awx_openshift_project=awx 
    + openshift_user=developer 
    + awx_node_port=30001 
    +# valid host port range 30000-32767 
    + openshift_password=developer 
    # Standalone Docker Install 
    -postgres_data_dir=/tmp/pgdocker 
    -host_port=80 
    +#postgres_data_dir=/tmp/pgdocker 
    +#host_port=80 
    # Define if you want the image pushed to a registry. The container definition will also use these images 
    -# docker_registry=172.30.1.1:5000 
    -# docker_registry_repository=awx 
    -# docker_registry_username=developer 
    + docker_registry=172.30.1.1:5000 
    + docker_registry_repository=awx 
    + docker_registry_username=developer

    Now, execute the installation with Ansible.

    ansible-playbook -i inventory install.yml

    Last, add a mounting point to AWX-Celery.

    #get the name of the AWX replica set
    export RS_AWX = oc get rs|awk  'FNR>1 {print $1}'
    oc scale --replicas=0 rs $RS_AWX
    
    #add volume to the replicaset that will be mounted to awx-celery
    oc patch rs $RS_AWX -p '{"spec":{"template":{"spec":{"volumes":[{"name":"awxprojectsdata","persistentVolumeClaim":{"claimName":"claim-awx"}}]}}}}'
    #mount the volume to awx-celery
    oc patch rs $RS_AWX -p '{"spec":{"template":{"spec":{"containers":[{"name":"awx-celery","volumeMounts":[{"mountPath":"/var/lib/awx/projects/","name":"awxprojectsdata"}]}]}}}}'
    
    oc scale --replicas=1 rs $RS_AWX

    After the launch of the Ansible playbook, if we go to OpenShift, we should be able to see the project.

    Image of OpenShift List Projects including AWX

    OpenShift projects list including AWX">

    The Ansible playbook installation creates a Postgress Database that will be in one Pod and will create the AWX pod that contains the Web tier, the engine, a cache and a queue. In another Pod it will be deployed the database:

    • AWX Web
    • AWX Celery
    • RabbitMq
    • Memcached
    • Postgress Database

    The installation also creates the network service and a route to have access to the AWX Web console.

    image of OpenShift AWX Deployment Configuration and networking details

    OpenShift AWX Deployment Configuration and networking details">

    Now, we should be able to access AWX going to a browser by using the uri from the exposed route. In my case, this is http://awx-web-svc-awx.127.0.0.1.nip.io the first screen of AWX should look something like this:

    image of the first AWX first screen

    Test the installation

    After the upgrade process of AWX is finished, we can log in to AWX and start using it. At this point, we will be ready to launch the demo project and the demo job, however, we won't be able to create and use other projects.

    Next, use the username 'admin' and the password 'password' to log in and you will be able to access AWX.

    image of AWX- Ansible Tower Dashboard

    AWX - Ansible Tower Dashboard">

    To verify that is running, you can download the sample project and run the job based on the sample template.

    Go to the Projects page and click the cloud download icon.

    SCM update icon

    Now, we can download the project from the git source.

    At this point, you can run the job based on the template.

    Just click the launch icon.

    launch template icon

    And here you have it the job is running.

    And here we see we have a Successful state job.

    Conclusion

    In this post, we covered how to install AWX, the upstream version of Red Hat Ansible Tower, on OpenShift. We also covered how to test the installation. These are the first steps to start using AWX. In the next post, I'm will cover how to configure Ansible Tower and show the best practices to run Playbooks to automate the provisioning and deployment on AWS.

    Last updated: March 23, 2023

    Recent Posts

    • More Essential AI tutorials for Node.js Developers

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    What’s up next?

     

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue