Forum Discussion

Mattews's avatar
Mattews
Icon for Cirrus rankCirrus
Sep 22, 2020

How to apply the same iRule to multiple application with AS3 declaration?

Hi,

I need to apply a single dynamic iRule (already configured on the BIGIP) to multiple application. Each time that there is a new change request the playbook (ansible), in conjunction with templates, must associates that iRule with the new application.

For the moment I have tried in this way:

[
  {
    "op": "add",
    "path": "/{{ Layer }}/TEST_{{ ServiceName }}",
    "value": {
      "class": "Application",
      "template": "generic",
      "{{ ServiceName }}": {
        "class": "Service_HTTP",
        "iRules": ["dynamic_irule"],
        "virtualPort": {{ virtualPort| int  }},
        "virtualAddresses": ["{{ IPvirtualServer }}"],
        "persistenceMethods": ["{{ metodoPersistenza }}"],
        "pool": "{{ Pools.0.nomePool }}"
      },
      "{{ Pools.0.nomePool }}": {
        "class": "Pool",
        "monitors": {{ Pools.0.monitor }},
        "members": [{
            "servicePort": {{ Pools.0.membersPort|int }},
            "serverAddresses": {{ Pools.0.IPmembers|list }}
        }]
      },
      "dynamic_irule": {
        "class": "iRule",
        "iRule": {
          "url": "/Frontend/TEST_{{ ServiceName }}/dynamic_irule"
        }
      }
    }
  }
]

I only need to find a precise way to declare the iRule, ansible returns this error:

["/Frontend/TEST_Test_Var_With_iRule/dynamic_irule/iRule: url /Frontend/TEST_Test_Var_With_iRule/dynamic_irule for /Frontend/TEST_Test_Var_With_iRule/dynamic_irule/iRule must include host"], "message": "declaration is invalid"}

TEST_Test_Var_With_iRule is the name of my app (it's all placed in variables), can you suggest me something to address this issue?

Thanks

No RepliesBe the first to reply