2

I am using the blasted version of AWX and I do not understand how to download additional collections. My instance is set up on K3s, single cluster. I am using GitLab as a source for my playbooks and changes. I have a collections/ directory on the root of my GitLab, but I feel there is more to it than just that.

When I try to execute the playbook, using the collection modules for VMware, it does not automatically download the collections like I’ve seen for most people. Is there an additional step to this that I am missing?

I configured AWX per instructions and created collections/requirements.yml file to download the collections.

SwiperNo
  • 59
  • 10

2 Answers2

1

Install the ansible-galaxy command if it is not already installed.

You can install it using the following command:

pip3 install ansible-galaxy

Navigate to your project directory and run the ansible-galaxy command to download the collections specified in the collections/requirements.yml file.

For example, if your requirements.yml file contains the VMware collection, you can run the following command:

ansible-galaxy collection install -r collections/requirements.yml

/!\ I'm not an expert with AWX with k3s but it may be help you

Ref to this: ansible docs AWX will detect it and run the needed ansible-galaxy command for you. Make sure that collection download has not been disabled in your awx/tower settings on the AWX console.

PavanDevarakonda
  • 625
  • 5
  • 27
mon gaté
  • 11
  • 3
1

@SwiperNo, I feel your pain. Reading your question, I can see that you have the right aspects for using galaxy with AWX. In my experience, and long hours of testing / troubleshooting, the following worked for me:

  1. A gitlab or github project with a "collections" folder and a "requirements.yml" within it.
  2. Contents of the requirements.yml might be:
--- 
collections:
- name: chocolatey.chocolatey
  source: https://galaxy.ansible.com
  1. Setup AWX with a "Source Control" credential using a token (Token generated from Gitlab/Github)

  2. Setup an AWX Project with the "Source Control Type" as "Git" and use the "Source Control Credential" created in step 3. I also ticked the option "Update Revision on Launch" to update the Git source in the cache a runtime.

  3. Ensure you have a PersistentVolume attached to the AWX instance. The Git source and collections need to cache it locally from what I understand and believe this could be part of your problem. See the following link re PersistentVolume, you can add the config to the awx.yml file, which you would have used to build the K3s instance at the begining. https://docs.ansible.com/automation-controller/4.0.0/html_zh/administration/operator_advanced_configurations.html#persist-projects-directory

  4. Lastly, I would recommend enabling verbose debugging within the template and see if there are errors which pertain to caching or the requirements.yml.

For reference, AWX build using K3s. https://github.com/ansible/awx-operator#persisting-projects-directory

gitday
  • 11
  • 1