Ad Code

Step-by-Step Guide for AWX Setup


AWX/ Ansible Server Requirements:
  • Supported Operating Systems: CentOS 8 64-bit to be running Openshift, Docker or Kubernetes (I used Docker)
  • Memory: 2 GB RAM minimum (4+ GB RAM recommended)
  • CPU: 3.4 GHz with 2 Cores
  • HDD: 20 GB
  • 64-bit support required (kernel and runtime)
  • Latest stable release of Ansible
    AWX Installation Steps:
    1. Install EPEL on CentOS 8
      dnf install epel-release -y
    2. Install additional packages and dependenciesdnf install git gcc gcc-c++ nodejs gettext device-mapper-persistent-data lvm2 bzip2 python3-pip
    3. Install Docker CE on CentOS 8
      dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
      dnf install docker-ce-3:18.09.1-3.el7
    1. To know what exact version of docker we have installed
      rpm -qa | grep docker
      or
      docker --version
    1. To start and enable docker
      systemctl start docker
      systemctl enable --now docker.service
    2. To set python command to use python 3 because in CentOS 8 and RHEL8, python 3 is installed as dependency when we install ansible
      alternatives --set python /usr/bin/python3
    3. Install Docker-Compose on CentOS 8
      pip3 install docker-compose
    1. Install Ansible AWX
      git clone https://github.com/ansible/awx.git
    2. Adjust few following parameters
      Navigate to the awx/installer directory and locate the inventory file.
           cd awx/installer/
           vi inventory
      Need to configure the Admin & Postgres password
           pg_admin_password=postgrespass@123
           admin_password=Linuxtechi@123
      To generate a cryptographic key for encryption of the inventory file
           openssl rand -base64 30
      To confirm and print out the changes made, run the command
          grep -v '^#' inventory | grep -v '^$'
    1. To install AWX run the Ansible command
      ansible-playbook -i inventory install.yml
    2. After the installation is done, check the containers which are launched via docker-compose
      docker ps
    3. Allow the http port (80) and https (443)
          firewall-cmd --permanent --add-service=http
          firewall-cmd --permanent --add-service=https
          firewall-cmd --reload
    1. Access AWX GUI Portal

    Managing AWX Console
    • Login to Ansible Tower / AWX with admin privileges.
      Admin
      Password

      Login Console
      • Add/ Create new credentials:
        Navigate to credentials tab. Click on “+” to create new credentials.
      Credentials Page


      • Enter the credential name, description, organization and search for credential type.
                  


      • From the list, select “Machine” to add username and password as credentials.
                      

      • Enter the username and password to store the credential.
                  This user account should be created in the AWX tower and NODES with root permission. 
                   Copy the ssh key from awx server to nodes to the following path, 
      vi ~/.ssh/id_rsa.pub
                  and give  chmod +700 authorized_keys to that file.
                  and give the folder ownership to that folder & file
                  chown awx:awx /home/awx/.ssh/
                  chown awx:awx /home/awx/.ssh/authorizedkeys

                  
                  This stored credential can be added in “Template” to authenticate with inventory host.  Similar way, you could authenticate with various services by selecting the right credentials type.


      Create Project:

          Select “Projects” from the menu and click the ‘+’ symbol to create new project.
              
              

              Once you clicked ‘+’ symbol, provide the following values:

              Name: “project name”

              and select the “organization” “here its default”

              and select “SCM Type “ “here its Manual, since I have .yaml files on local machine” else select “Git”.

              “Project base path”: The default project path on local machine is “/var/lib/awx/projects”, the .yaml files should be kept here on AWX server. Then only the playbook directory will list under “Playbook Directory” comb box, else NO.

              Once the values are given click “save” to create project.

              

      Create Inventory:

              Select “Inventories” from the menu and click the ‘+’ symbol to create new inventory.
              

              Once you clicked ‘+’ symbol, provide the following values:

              Name: inventory name

              Organization: default

              


              Under “Hosts” tab add the host-names for this inventory.

              


      Create Template:
              Select “Templates” from the menu and click the ‘+’ symbol to create new template.


              

              Once you clicked ‘+’ symbol, provide the following values:

              Name: template name

              Job type: Check/ Run/ Scan – here “run”

              Inventory: select already created inventory

              Project: select already created project

              Playbook: The combo box lists the playbooks under the selected project, select the one you want to run at this time

              Credentials: select already created credentials

              Verbosity: it can be default, else select as per the your verbose requirement



                  


              Options: “enable privilege escalation” to run the playbook with sudo permission.

                  

      Launch the playbook:

              Click the “Jet” button from templates to launch/ run the playbook under that template.

              









          Reactions

          Post a Comment

          0 Comments