Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install galaxy collection on awx ee #312

Closed
fferraro87 opened this issue May 17, 2021 · 2 comments
Closed

install galaxy collection on awx ee #312

fferraro87 opened this issue May 17, 2021 · 2 comments

Comments

@fferraro87
Copy link

ISSUE TYPE
  • Question
SUMMARY

add galaxy collection to ansible environment

ENVIRONMENT
  • AWX version: 19.0.0
  • Operator version: 0.9.0
  • Kubernetes version: v1.20.6+k3s1
  • AWX install method: openshift, minishift, docker on linux, docker for mac, boot2docker

How can i install an ansible galaxy collection in order to use on a template?
I need to rebuild awx ee? and how?
Thanks

@duntonr
Copy link

duntonr commented May 18, 2021

AFAIK there are two main ways:

  1. use ansible-builder - https://www.linkedin.com/pulse/creating-custom-ee-awx-phil-griffiths?trk=public_profile_article_view
  2. extend an official, existing awx-ee image for your needs - something like Unable to use custom EE image awx#9917 (comment)

I started with ansible-builder but has issues with galaxy installed collections being found after upgrading to 19.1 so I made my own Dockerfile, like ansible/awx#9917 (comment), but customized for my needs (didn't need Kerberos, etc)

FROM quay.io/ansible/awx-ee:0.2.0

USER root

# install OS binaries
RUN yum -y install \
ca-certificates \
gcc \
git \
git-lfs \
krb5-devel \
krb5-libs \
krb5-workstation \
libcurl-devel \
libxml2-devel \
openssl-devel \
python3-jmespath \
python3-netaddr \
python3-passlib \
python3-pycurl \
python38-devel \
python38-pytz \
python38-pyyaml \
python38-requests \
qemu-img

# add Python dependencies and Ansible
# Galary dependencies
ADD requirements.yml /tmp/requirements.yml
ADD requirements.txt /tmp/requirements.txt

# upgrade pip
RUN /usr/bin/python3 -m pip install --upgrade pip

# install Ansible Galaxy collections
RUN ansible-galaxy collection install -r /tmp/requirements.yml --collections-path /usr/share/ansible/collections

# install Python dependencies
RUN pip install -r /tmp/requirements.txt

# add certificates
RUN update-ca-trust force-enable
RUN chmod -R 0777 /usr/share/ansible/collections 

USER 1000

NOTE

I've had permission issues on and off with different versions, so I added RUN chmod -R 0777 /usr/share/ansible/collections to make sure it didn't happen again. I'm using this in a home lab but for anything more than that, its best probably not to have that line and optimize the image more

Overall, I just needed community.general added, so the requirements files look like

requirements.yml -

---
collections:
  - community.general

requirements.txt-

urllib3
git+https://github.com/ansible/ansible-builder.git@devel#egg=ansible-builder

Once you have built your custom docker image (either via ansibler-builder or Dockerfile)

  1. Push it to your own docker repo
  2. Setup a new Execution Environment in AWX (you can add a credential if its a private docker repo)
  3. configure your template(s) to use the new EE

@wenottingham
Copy link

This issue tracker is for tracking feature enhancements and bugs to the awx operator itself.

If you need help troubleshooting an AWX install or an EE build, try our mailing list or IRC channel:

Mailing list: https://groups.google.com/forum/#!forum/awx-project
IRC: ansible-awx on irc.libera.chat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants