Forum Discussion

sels1987's avatar
sels1987
Icon for Nimbostratus rankNimbostratus
May 15, 2023

Add rule or rulelist at beginning F5 security firewall policy using ansible

Hi Team,

We can see option called "Add rulelist at beginning" in BigIP server. To achieve this through automation, I don't find an option in ansible. I used the listed below module to add rulelist but adding to first position is a blocker.

  • F5Networks.F5_Modules

Please help to get a solution to the issue.

4 Replies

    • sels1987's avatar
      sels1987
      Icon for Nimbostratus rankNimbostratus

      Hi Matt,

      This link has partial answer.

      1. How to bring rules and rulelists name of firewall security policy

      ex: I have a policy "POL01" and have 3 rules - Rule01, Rule02 & Rule03, 2 rulelists - Rulelist01 & Rulelist02 and default-deny rule.

      I am using tmsh list security firewall policy POL01 command to bring firewall policy details as I don't find f5_modules to get security firewall policy rules/rulelists. Unable to use the output of tmsh to convert to JSON or any object.

      2. I added a new rule or rulelist. But not associate to policy. Assume, I got name of rules, rulelists of policy and  execute bigip_firewall_rule module to associate and order the new rule/rulelist. Order & association happened as expected. But problem here is new rule or rulelist is not have proper configuration instead it has default deny configuration.

      Workaround: Associate new rule/rulelist then for order the rules/rulelist - use "Dummy" in the rules ["New-Rulelist", "Rulelist01", "Rulelist02", "Rule01", "Rule02", "Rule03", "Default-Deny", "Dummy"] and then order again without "Dummy" ["New-Rulelist", "Rulelist01", "Rulelist02", "Rule01", "Rule02", "Rule03", "Default-Deny"]

      • sels1987's avatar
        sels1987
        Icon for Nimbostratus rankNimbostratus

        Please ignore my second point as thread have answer to switch association and order to solve blank rule issue.

        Please help for the first point. - How to bring rules and rulelists name of firewall security policy

  • Hi Team,

    Do we have option to fetch rules, rulelists name of security firewall rules ? This is a blocker for me.