Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
code share

F5 Archiver Ansible Playbook

Problem this snippet solves:

Centralized scheduled archiving (backups) on F5 BIG-IP devices are a pain however, in the new world of Infrastructure as Code (IaC) and Super-NetOps tools like Ansible can provide the answer.

I have a playbook I have been working on to allow me to backup off box quickly, UCS files are saves to a folder names tmp under the local project folder, this can be changed by editing the following line in the f5Archiver.yml file:

dest: "tmp/{{ inventory_hostname }}-{{ date['stdout'] }}.ucs"

The playbook can be run from a laptop on demand or via some scheduler (like cron) or as part of a CI/CD pipelines.

How to use this snippet:

F5 Archiver Ansible Playbook

Gitlab: StrataLabs: AnsibleF5Archiver


This Ansible playbook takes a list of F5 devices from a hosts file located within the inventory directory, creates a UCS archive and copies locally into the 'tmp' direcotry.


This Ansible playbook requires the following: * ansible >= 2.5 * python module f5-sdk * F5 BIG-IP running TMOS >= 12


Run using the ansible-playbook command using the inventory -i option to use the invertory directory instead of the default inventory host file.

NOTE: F5 username and password are not set in the playbook and so need to be passed into the playbook as extra variables using the --extra-vars option, the variables are f5User for the username and f5Pwd for the password. The below examples use the default admin:admin.

To check the playbook before using run the following commands

ansible-playbook -i inventory --extra-vars "f5User=admin f5Pwd=admin" f5Archiver.yml --syntax-check

ansible-playbook -i inventory --extra-vars "f5User=admin f5Pwd=admin" f5Archiver.yml --check

Once happy run the following to execute the playbook

ansible-playbook -i inventory --extra-vars "f5User=admin f5Pwd=admin" f5Archiver.yml