Science and technology

How to run AWX on Minishift

The upstream model of Red Hat’s Ansible Tower product is AWX. It’s a containerized answer, which implies you want a container orchestrator to run and take care of it. A neat native set up choice is Minishift, which runs OKD, Red Hat’s model of Minikube, which makes it simpler to run Kubernetes regionally.

If you are already utilizing Minishift…

First, to make sure issues go easily, blow away any outdated Minishift cases.

$ minishift cease && minishift delete
$ rm -rf ~/.minishift ~/.kube

Also delete any outdated minishift-addons you could have mendacity round.

Download and set up Minishift

Download the most recent model of Minishift from its GitHub repository. (As this was printed, that is v1.25.zero, and I am utilizing it for MacOS together with VirtualBox.)

$ tar zxfv the obtain and put the minishift-* binary someplace in your path. I used /usr/native/bin/minishift.

The largest points I’ve had with Minishift are round upgrades, the place a conflicting older Minishift or oc binary may cause points. (oc is OKD’s command-line interface.)

AWX wants not less than 4 cores with 8GB to put in, so arrange some limits (give it extra energy should you can).

$ minishift config set vm-driver virtualbox
$ minishift config set cpus four
$ minishift config set reminiscence 8gb
$ minishift config view

Make certain the default add-ons are put in as we want ‘admin-user’ so we will make cluster degree modifications

$ minishift addons set up --defaults
$ minishift addons allow admin-user
$ minishift addons record
​$ minishift begin

Wait for it to obtain and set up. This can take some time in case your broadband is like mine!

A number of extra steps…

There are a few different issues to arrange earlier than putting in AWX.

First, ensure that to select the appropriate oc binary—or issues may get bizarre.

$ eval $(minishift docker-env)

The regular person (on this instance, “developer”) wants further rights to do issues on the cluster degree.

$ oc login -u admin -p admin --as=system:admin
$ oc adm coverage add-cluster-role-to-user cluster-admin developer --as=system:admin

The AWX playbook set up creates a venture, however it would not damage to create it forward of time so you’ve a persistent storage quantity (PV) for the database.

$ oc new-project awx

Create a file known as pvc.yml with this content material:

$ cat > pvc.yml <<EOF
apiVersion: "v1"
type: "PersistentVolumeClaim"
metadata:
 identify: "postgresql"
spec:
 accessModes:
  - "ReadWriteMany"
 sources:
  requests:
   storage: "20Gi"
 volumeName: pv0001
EOF

Minishift creates quite a few PVs as a part of the set up; simply make a declare for one in all them.

$ oc get pv

To view them and choose a free one, substitute the quantity identify (“pv0001” within the instance above) if it is already taken. For instance,

$ oc create -f pvc.yml

will make a declare on the PV, be picked up by the installer, and be used as a PV for the Postgres database.

$ oc get pvc 

Check the output exhibits the PV as Bound:

NAME

STATUS

VOLUME

CAPACITY

ACCESS MODES

STORAGECLASS

AGE

postgresql

Bound

pv0001

100Gi

RWO,ROX,RWX

 

10s

Install AWX

Finally it is time to set up AWX. Enter:

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

Make modifications to the stock file so issues will fit your atmosphere.

$ cp stock stock.outdated

The following works for my stock file:

$ cat > stock
localhost ansible_connection=native ansible_python_interpreter="/usr/bin/env python"

[all:vars]

dockerhub_base=ansible
dockerhub_version=newest

openshift_host=192.168.99.100:8443
openshift_project=awx
openshift_user=developer
openshift_skip_tls_verify=True
openshift_pg_emptydir=False

postgres_data_dir=/tmp/pgdocker
host_port=80
docker_compose_dir=/var/lib/awx

pg_username=awx
pg_password=awxpass
pg_database=awx
pg_port=5432

rabbitmq_password=awxpass
rabbitmq_erlang_cookie=cookiemonster

admin_user=admin
admin_password=password
secret_key=awxsecret
EOF

You may want to vary the openshift_host IP. Check yours by working:

$ minishift ip

Now you are able to go!

$ ansible-playbook -i stock set up.yml -e openshift_password=developer -e docker_registry_password=$(oc whoami -t)

The playbook will hearth off all kinds of duties; some may fail (in the event that they do, they will present up in pink). This is generally high-quality. My set up took round 5-6 minutes as a information.

Log into the Minishift console utilizing the command:

$ minishift console

and the credentials developer/developer to see what’s occurring beneath the covers.

Select the awx venture from the GUI, and pods and containers will begin to be created.

Note that the ansible-tower-management pod will come and go as soon as the Postgres database is ready up. TASK [kubernetes: Migrate database] does this from the playbook run.

After a couple of minutes, you must get a abstract, comparable to:

 ------------

     ^__^

      (oo)_______

      (__)   )/

        ||----w |

        ||  ||

localhost         : okay=35 modified=17 unreachable=zero  failed=zero

As lengthy as unreachable=zero and failed=zero, try to be set.

Click on the route beneath the awx useful resource within the GUI, and you must have the ability to log into the AWX GUI admin/password (from the stock file above).

Make certain the pod circle is blue and due to this fact “ready.”

Two potential gotchas

Minishift or oc binaries usually are not in sync with the discharge used. Even although it appears to work (to a level), when doubtful, blow away the outdated config!

PVC declare appeared to seize the quotes round pv0001 and would not bind, so I eliminated them and it labored. This might have been a replica and paste error. 


The unique model of this text was printed on LinkedIn and is reprinted with the creator’s permission.

Most Popular

To Top