on 05-Jun-2020 15:42
In its simplest form, an Ansible Collection is a package of related Ansible resources, which include Modules, Roles, Playbooks, and Plugins. Prior to Ansible Collections if you wanted to gather all of these resources it was much like picking out individual ingredients at the grocery store to prepare a meal. You would need to download the Ansible version you need, import Roles from Galaxy, customize your playbooks, and so on; when all you want is a finished meal. Collections allow this experience to be similar to going to a restaurant and picking the meal you want. The Collection is ready to go without having to worry about the resources (ingredients) involved. You can look at a Collection as a complete offering from a vendor for a given use case. An amazing byproduct of this aggregated approach is that it allows Ansible to bless specific Collections as Certified on Automation Hub (more on this later). Ansible Collections give you stability, flexibility, and quick access to new features to get the job done.
F5 releases its modules Collection through three venues:
F5 is a Certified Partner within Ansible which means that our Collection is available through Automation Hub. This offers content that is backed by not only by F5 but by Red Hat as well providing reassurance for your mission critical environments. If you are subscribed to Automation Hub then you can update you local Galaxy settings to download from there following this guide. Afterwards, the command to install the collection will be identical to using the community version from Ansible Galaxy (example in next section below).
Collections are also available through Ansible Galaxy. If you are familiar with the current process of installing Roles, then this should seem very similar to you. A simple one-line command will download the latest version of F5s Collection into your Ansible environment.
ansible-galaxy collection install f5networks.f5_modules -p ./collections
We deliver a tar.gz version each day which can be accessed through the README on our github repo. After downloading the file you can install the collection from CLI by referencing the new file instead of Galaxy or Automation Hub.
ansible-galaxy collection install f5networks-f5_modules-x.y.z-devel.tar.gz -p ./collections
Given the above benefits it sounds like there might be a major effort involved in leveraging a Collection if I already have an Ansible install base. Luckily ease of adoption was a big part of this transition. Change a few lines in your existing playbooks and you are now using the F5 Collection in place of Core Modules.
You have 2 primary options for making the update:
This is best when you have different Collections that you want to use depending on the given Task.
... - name: Create Pool f5networks.f5_modules.bigip_pool: name: test-pool ...
This will tell each Task within your playbook that the intended collection context is f5networks.f5_modules. This is best when you want to apply a Collection context to every task in the play
- name: Use Collections hosts: f5 connection: local collections: - f5networks.f5_modules ...
F5 can now release new versions of our Collection the second we can offer new value to a customer. Prior to Collections a new feature could be code complete, but customer consumption was only possible after the release of an entire Ansible version. Not only has our official release cadence become more Agile but we have the Daily Build of our Collection that can be used for testing prior to official releases.
Most of us have been there ... managing our Ansible environment and it's running and stable, but you need one new feature released in the latest Ansible version. Performing that upgrade prior to Collections meant that you were not just getting that one new feature, but you were getting every code change to every vendor that contributes to Ansible. Collections greatly reduce this blast radius of making these sort of upgrades within Ansible. With Collections I can target specific vendors and update only that Collection. I can save time ($$$) by narrowing down the testing and certification of my existing workflows to ones that were updated.
Virtual python environments were also frequesntly used to help alleviate the blast radius issue. Now that you can have more granular control over the Ansible install itself, you can reduce the number of virtualenvs required within your deployments. Less environments means less to manage and maintain. WIN!!
Collections are a great advancement in the delivery process of F5s Ansible offering. They enable F5 to deliver customer value at an increased velocity greatly benefiting both parties. Make sure to check out our other Collections as well including NGINX Controller and F5 Beacon. Additional resources are available below to find out more about F5 Ansible Collections.