f5-ansible icon indicating copy to clipboard operation
f5-ansible copied to clipboard

bigip_policy_rule - error with doc example for set_variable action

Open xavgra2 opened this issue 4 years ago • 2 comments

Trying to improve the automation of F5 config, I try to switch to ansible for policy configuration. Before trying to implement my need based on the doc (using replace action), I first try to make the example of the galaxy documentation working. All the example are working except :

      - name: rule3
         actions:
           - type: set_variable
             variable_name: user-agent
             expression: tcl:[HTTP::header User-Agent]
             event: request
         conditions:
           - type: http_uri
             path_begins_with_any:
               - /HomePage/

Which return this error "msg": "Unsupported parameters for (bigip_policy_rule) module: event, expression, variable_name found in actions. Supported parameters include: asm_policy, location, pool, type, virtual"}

xavgra2 avatar Jun 29 '21 22:06 xavgra2

Created INFRAANO-431 for internal tracking

trinaths avatar Jul 06 '21 11:07 trinaths

Hi, Is it possible to have a status of the internal ticket ? The documentation is still the same, and the error still occurs.

xavgra2 avatar Mar 17 '22 08:03 xavgra2

Hi @xavgra2, I tried the following playbook with success:

  tasks:
    - name: Create policies
      bigip_policy:
        name: Policy-Foo
        state: present
        provider:
          server: "{{private_ip}}"
          user: "admin"
          password: "mypwd"
          server_port: 443
          validate_certs: false
      delegate_to: localhost

    - name: Add a rule to the new policy
      bigip_policy_rule:
        policy: Policy-Foo
        name: rule3
        conditions:
          - type: http_uri
            path_begins_with_any:
              - /ABC
        actions:
          - type: forward
            pool: pool-svrs
        provider:
          server: "{{private_ip}}"
          user: "admin"
          password: "mypwd"
          server_port: 443
          validate_certs: false
      delegate_to: localhost

    - name: Add multiple rules to the new policy
      bigip_policy_rule:
        policy: Policy-Foo
        name: "{{ item.name }}"
        conditions: "{{ item.conditions }}"
        actions: "{{ item.actions }}"
        provider:
          server: "{{private_ip}}"
          user: "admin"
          password: "mypwd"
          server_port: 443
          validate_certs: false
      delegate_to: localhost
      loop:
        - name: rule1
          actions:
            - type: forward
              pool: pool-svrs
          conditions:
            - type: http_uri
              path_begins_with_any:
                - /euro
        - name: rule2
          actions:
            - type: forward
              pool: pool-svrs
          conditions:
            - type: http_uri
              path_begins_with_any:
                - /HomePage/
        - name: rule3
          actions:
            - type: set_variable
              variable_name: user-agent
              expression: tcl:[HTTP::header User-Agent]
              event: request
          conditions:
            - type: http_uri
              path_begins_with_any:
                - /HomePage/

Are you still facing the issue?

pgouband avatar Dec 01 '22 17:12 pgouband

Hi, The issue has been solved since a few release, but I forgot to close my ticket. I apologize for that.

I confirm that's OK now.

xavgra2 avatar Jan 26 '23 12:01 xavgra2