Install F5 Modules for Ansible

This document explains how to install the F5 Modules for Ansible.

Install Python

Install the latest version of Python (2.7 minimum) if you do not already have it.

Install Ansible Core

Next, install Ansible (2.7.0 or later):

F5 recommends that you install Ansible by using virtualenv/pip. For an example, see Install Ansible by using virtualenv.

Install F5 Ansible Collections

The final task is to install the F5 Ansible Collections.

Requirements

  • Ansible 2.9 or later
  • In the following examples, we assume collections are stored in a relative path to the working directory. All commands are run in the working playbook directory.
    To set the working directory, add the following line to ansible.cfg in your working directory: collections_paths = ./collections
    If you do not set the relative path, the default path is ~/.ansible/collections

Installing Collections

Both the official or daily build are placed in this folder structure: ./collections/ansible_collections/f5_modules

Official Releases

Daily Build (testing pre-released updates)

  • Download the daily build from AWS S3:

    wget https://f5-ansible.s3.amazonaws.com/collections/f5networks-f5_modules-devel.tar.gz

  • Install the collection build that was downloaded:

    ansible-galaxy collections install f5networks-f5_modules-devel.tar.gz


Referencing a Collection in a playbook

There are two options for referencing a Collection in a playbook:

  1. Preface each module, role, or resource with the collection name:

    - name: Use Collections
        hosts: f5
        connection: local
    
        tasks:
        - f5networks.f5_modules.bigip_pool:
            name: my-pool
            partition: Common
    
  2. Specify the collection for the entire play (any module found in the collection will be used before core)

    - name: Use Collections
        hosts: f5
        connection: local
    
        collections:
        - f5networks.f5_module
    
        tasks:
        - bigip_pool:
            name: my-pool
            partition: Common
    

Ansible Collection Documentation

For more details on Ansible Collections, see the Ansible documentation