Create a declarative onboarding template to use with F5 SDK
Late last year I created an internal tool to change the hostnames of BIG-IP lab devices and configure them in a device group for use in our AskF5 videos. I chose to use Declarative Onboarding (DO) with F5 SDK for the project. Since I was gathering input from users via a web form, I needed a way to plug that input into the DO declaration. The solution was to use the python package, Jinja2, which allowed me to turn the JSON declaration into a template. With Jinja2, you can do the following:
"failoverGroup": {
"class": "DeviceGroup",
"type": "sync-failover",
"members": [
"{{ mgmt_ip_1 }}",
"{{ mgmt_ip_2 }}"
],
"owner": "/Common/failoverGroup/members/0",
"autoSync": false,
"networkFailover": true
}
The values for members are the variables {{ mgmt_ip_1 }} and {{ mgmt_ip_2 }}, which get assigned by user input.
After creating the program, I recognized that our customers would probably like to give this a whirl too, so I created a new CLI version of the project (since using Django seemed a little too complex for an AskF5 article) and updated the declaration to include self IPs, VLANs, and all the properties for DSC so you can perform basic onboarding. The AskF5 article K04414890 provides a walk-through for using the program on your BIG-IP systems. This is the first time that AskF5 has used GitHub to store code for an article. This new way of doing things allows you to clone the project or download it from the GitHub UI rather than copy/paste from the article. Once you are comfortable with how it works, you can refer to the guide at the end of the article for customizing the code to include other DO classes.
If you have any questions about running or customizing the program, or suggestions on how to improve the code, please leave a comment.
Refer to the article to get started:
K04414890: Advanced Administrator: Create a declarative onboarding template to use with F5 SDK