Forum Discussion

Mattews's avatar
Mattews
Icon for Cirrus rankCirrus
Nov 10, 2020

How to POST multiple declaration with AS3 without overwrite the existent ?

Hi

I need to know how to configure multiple VIP without overwrite the existent.

For now I have this declaration:

{
    "class": "AS3",
    "action": "deploy",
    "persist": true,
    "declaration": {
        "class": "ADC",
        "schemaVersion": "3.0.0",
        "id": "example-declaration-01",
        "label": "Sample 1",
        "remark": "Simple HTTP application with round robin pool",
        "{{ Layer }}": {
            "class": "Tenant",
            "defaultRouteDomain": 0,
            "{{ nomeServizio }}": {
                "class": "Application",
                "template": "generic",
            "{{ nomeServizio }}": {
              "class": "Service_HTTP",
              "iRules": [{"bigip": "/Common/dynamic_irule"}],
              "virtualPort": {{ virtualPort| int  }},
              "virtualAddresses": ["{{ IPvirtualServer }}"],
              "persistenceMethods": ["{{ metodoPersistenza }}"],
              "pool": "{{ item.nomePool }}"
            },
            "{{ item.nomePool }}": {
              "class": "Pool",
              "monitors": {{ item.monitor }},
              "members": [{
                  "servicePort": {{ item.membersPort|int }},
                  "serverAddresses": {{ item.IPmembers|list }}
              }]
            }
            }
        }
    }
}

Now I POST this declaration using extra vars like "metodoPersistenza" etc in order to configure a VIP with external parameters, but if I try to POST this declaration again (with others extra vars) AS3 overwrites the previous VIP...

How can I do to configure multiple VIP in multiple declarations without overwriting the existent configurations?

Thanks in advance

1 Reply

  • When you use AS3, you are declaring what final state you want the BIG-IP to be in when the declaration is applied. Don't think of using AS3 to add vips like you would run it 4 times to add 4 vips. You would want to define all the vips in the same declaration and post it at once. All the vips you want to add would be under the tenant: "{{Layer}} in your case.

    In your case, add another {{nomeServizio}} to the same declaration.

     

    See here, an example that has 2 virtual servers configured in the same declaration, all under one tenant

    https://clouddocs.f5.com/products/extensions/f5-appsvcs-extension/latest/declarations/http-services.html#http-and-https-virtual-services-in-one-declaration