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

Overview

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.

Requirements

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

Usage

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

Tested this on version:

12.1

2 Likes

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?