Advertisement
mashiahd

F5 ASM Policies Export

Jan 19th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.10 KB | None | 0 0
  1. #!/bin/bash
  2. #export4grading.sh
  3. #Create directory for export if it doesn't exist
  4. mkdir -p /shared/asm_policy_4grading
  5.  
  6. #Set initial expoort date/time for tagging purposes
  7. export_date=`date +%Y_%m_%d-%H%M`
  8.  
  9. #Enumerate all policy names and iterate through exporting twice
  10. for policy in `tmsh list asm policy one-line | awk '{print $3}'`
  11.         do
  12.                 tmsh save asm policy $policy xml-file /var/tmp/${policy}_${export_date}.asmxml
  13.         done
  14.  
  15. for policy in `tmsh list asm policy /F5_TEST_ENVIRONMENT/* one-line | awk '{print $3}'`
  16.        do
  17.                 tmsh save asm policy $policy xml-file /var/tmp/Test_${policy}_${export_date}.asmxml
  18.         done
  19.  
  20. for policy in `tmsh list asm policy /Integration_Env/* one-line | awk '{print $3}'`
  21.         do
  22.                 tmsh save asm policy $policy xml-file /var/tmp/Integration_${policy}_${export_date}$
  23.         done
  24.  
  25.  
  26.  
  27. #compress exported policy files and place in backup folder
  28. tar -zcvf /shared/asm_policy_4grading/ASM_Policies_${export_date}.tgz /var/tmp/*${export_date}*
  29.  
  30. #clean up exported files post archive
  31. rm /var/tmp/*.asmxml
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement