So while we were poking around in Ansible Tower, we started to be curious about leveraging collections that are located in either Ansible Automation Hub or Ansible Galaxy. At the time of this post, our version of Ansible Tower didn’t seem to include the UI functionality to logically point our Tower system to a Ansible Galaxy or Ansible Automation Hub (Sir, google can you help). After a small amount of research, we found that the commands to install community sourced modules and in this case the windows collection from Ansible Galaxy were fairly straight forward.
ansible-galaxy collection install community.windows
Although this did installed the module on the Development Ansible Tower Instances (I personally don’t like to play in production), it installed in the wrong directory. This was fairly simple to resolve by adding the -p flag to the ansible-galaxy collection install command. We still had a little bit of an issue figuring out where the module should install too. After some poking around and some good’ole use of the find command, we found a location on the RHEL instance.
ansible-galaxy collection install community.windows -p /usr/share/ansible/collections/
I have no clue why my brain didn’t default to this location for installation. It’s really similar to the management format provided for firewalld service files (derphat). In any case, we were able to run the above command, which installed the collection into the correct directory. After a restart of the Tower services (I am not certain if this is necessary and will test on the next one), we were able to leverage the collection in playbooks. We leveraged the disk initialization module below.
tasks: - name: Drive Configuration community.windows.win_initialize_disk: disk_number: 3 style: gpt online: yes
Adding the ability to use community sourced modules to your Ansible Tower instances can not only save you time, but also help with product adoption and ease the coding burden for Team Members that may be not as familiar with writing in yaml. This method although working is not going to be my go to production method for this functionality (if I can help it). This is just the first instance of our utilization of community items in current work. My preferred method at the time of this writing is going to be requirement files, but I still have to think about some additional concerns (security access, supported modules, and updates).