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

stateless VS in a partition raise error

Open oldmanhere opened this issue 9 months ago • 5 comments

COMPONENT NAME

bigip_virtual_server

SUMMARY

When you want to create a stateless mode VS in a partition (not in Common), the module always raise a error: "A udp profile, must be specified when 'type' is 'stateless'." even you provide /Common/udp in profiles

I have solved this trouble and report solution here.

Broken code
in read_udp_profiles_from_device
    result = [fq_name(self.want.partition, x['name']) for x in response['items']]
Solution: replace the broken line with this:
in read_udp_profiles_from_device
    result = [x['fullPath'] for x in response['items']]

(you have same change already done in read_fastl4_profiles_from_device)

oldmanhere avatar May 26 '25 15:05 oldmanhere

Hi @oldmanhere,

Could you share your playbook?

As a workaround you can use AS3.

pgouband avatar May 26 '25 15:05 pgouband

Sorry, but AS3 is not a option. For my knowledge, could you share a AS3 playbook ?

A sample playbook could be (mine is too big):

---
- name: Deploy virtual servers on F5 BIG-IP
  hosts: localhost
  gather_facts: no
  collections:
    - f5networks.f5_modules

  vars:
    my_partition_name: MY_SAMPLE_PARTITION_NAME

    # MY_SAMPLE_PARTITION_NAME must exist as a partition
    # MY_SAMPLE_POOL_NAME must exist (created before)
    # MY_SAMPLE_NETWORK_NAME must exist (created before)

    Sample_list_VS:
      - name: MY_SAMPLE_VS_NAME
        type: stateless
        ip_protocol: udp
        partition: "{{ my_partition_name }}"
        pool: MY_SAMPLE_POOL_NAME   # with udp syslog members
        translateServerAddress: true
        translateServerPort: false
        profiles:
          - /Common/udp
        virtualAddress: 172.16.1.10 # sample ip
        virtualPort: 514  # syslog port
        allowVlans:
          - /Common/MY_SAMPLE_NETWORK_NAME

    provider:
      <snip: bring you own>

  tasks:
    - name: Create/update virtual servers
      f5networks.f5_modules.bigip_virtual_server:
        state: "{{ item.state | default('present') }}"
        partition: "{{ item.partition }}"
        name: "{{ item.name }}"
        type: "{{ item.type | default(omit) }}"
        ip_protocol: "{{ item.ip_protocol | default(omit) }}"
        destination: "{{ item.virtualAddress }}"
        address_translation: "{{ item.translateServerAddress | default(true) }}"
        port_translation: "{{ item.translateServerPort | default(true) }}"
        port: "{{ item.virtualPort }}"
        pool: "{{ item.pool | default(omit) }}"
        snat: "{{ item.snat | default('Automap') }}"
        description: "{{ item.description | default(omit) }}"
        irules: "{{ item.iRules | default(omit) }}"
        profiles: "{{ item.profiles | default(omit) }}"
        policies: "{{ item.policies | default(omit) }}"
        per_flow_request_access_policy: "{{ item.per_flow_request_access_policy | default(omit) }}"
        default_persistence_profile: "{{ item.default_persistence_profile | default(omit) }}"
        enabled_vlans: "{{ item.allowVlans | default(omit) }}"
        provider: "{{ provider }}"
      loop: "{{ Sample_list_VS }}"
...

oldmanhere avatar May 26 '25 16:05 oldmanhere

Hi @oldmanhere,

Thanks for the playbook.

You can find playbook example for AS3 here: https://clouddocs.f5.com/products/orchestration/ansible/devel/f5_bigip/modules_2_0/bigip_as3_deploy_module.html#bigip-as3-deploy-module-2

pgouband avatar May 26 '25 17:05 pgouband

@pgouband it's difficult to imagine a stateless VS creation AS3 playbook with your samples. The syntax is really difficult. Can you create it here please ? Use the same sample i provide. Thanks.

Otherwise, the trouble i've solved for the stateless VS exist elsewhere. You can probably expect trouble with partitions in read_dhcpv4_profiles_from_device, read_dhcpv6_profiles_from_device, read_fasthttp_profiles_from_device and read_udp_profiles_from_device for now, only read_fastl4_profiles_from_device is good.

oldmanhere avatar May 26 '25 17:05 oldmanhere

Hi @oldmanhere,

Here an example of AS3 declaration for stateless udp VS: https://clouddocs.f5.com/products/extensions/f5-appsvcs-extension/latest/declarations/non-http-services.html#creating-a-stateless-udp-virtual-server

pgouband avatar May 26 '25 17:05 pgouband