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

under the local project folder, this can be changed by editing the following line in the

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

The playbook can be run from a laptop on demand or via some scheduler (like

) 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

file located within the
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

command using the inventory
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

option, the variables are
for the username and
for the password. The below examples use the default

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

Tested this on version:

Updated Jun 06, 2023
Version 2.0

Was this article helpful?

1 Comment

  • This looks great but I'm coming across an error about 30 seconds or so into the creation task - "400 Unexpected Error: Bad Request for uri". Further down the log I see "java.util.concurrent.TimeoutException"

    The UCS gets created fine but it seems to be timing out. I've tried using async and checking the status of the job but that too produces the same error after around 15 (out of 30) checks.


    Any idea what might be causing this?