Dustin Burmeister
Dustin Burmeister

Reputation: 31

How do I run ansible-galaxy installations using AWX?

So I've read over the other articles that are similar to this question and while they provided an accepted answer, I wasn't able to quite get there. I am running AWX on Fedora 35. I have installed it using the following guide.

https://computingforgeeks.com/install-and-configure-ansible-awx-on-centos/

After I finished this guy I also did

yum install Ansible

After I did what was said to do on the juniper website which is

ansible-galaxy install collection juniper.device

sudo ansible-galaxy install Juniper.junos

When I attempt to run my template I get the following.

ansible-galaxy error

The other article question/answer I read earlier stated (I also went to the Ansible site) that I need to create a requirements.yml file. I'm not sure where my issue is coming into play but I can't get it to work. Either I don't know where the requirements file is supposed to go. I put it in /var/lib/awx/projects/_8__getconfigs/collections and /var/lib/awx/projects/_8__getconfigs/roles

/var/lib/awx/projects/_8__getconfigs/collections

Inside of the files is very simple (and probably wrong).

Roles

---
roles:
  - name: Juniper.junos

Collections

---
collections:
  - name: juniper.devices

Lastly I was talking with someone earlier and they mentioned privileges which could make sense. There is no account for awx on my system. If anyone could help me it would be greatly appreciated. Thank you in advance!

Upvotes: 1

Views: 2182

Answers (1)

Khaled
Khaled

Reputation: 838

You can do that using Execution Environments in AWX

enter image description here

1. Create a Dockerfile from awx-ee image containing the collections:

    FROM quay.io/ansible/awx-ee:latest
    
    RUN ansible-galaxy collection install gluster.gluster \
     && ansible-galaxy collection install community.general

Build the Image: docker build -t $ImageName .
Log in to your Docker repository: docker login -u $DockerHubUser
Tag the image: docker image tag $ImageName $DockerHubUser/$ImageName:latest
Push the image to Hub: docker image push $DockerHubUser/$ImageName:latest

2. Add Execution Environment to AWX:
The image location, including the container registry, image name, and version tag EE
3. That's it:

enter image description here enter image description here I've tested that already on a fresh AWX instance, where there is no collections installed.

You don't have to refer to the collection in a requirements.yml file

Whenever a new Galaxy Collection is needed, it should be added to the Dockerfile and pushed to Hub.

You can even install normal Linux packages in the docker image if needed.

Upvotes: 2

Related Questions