---
- name: Dell OpenManage Ansible VLAN operations.
  hosts: ome
  gather_facts: false

  tasks:
    - name: Create a VLAN range
      dellemc.openmanage.ome_network_vlan:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        ca_path: "/path/to/ca_cert.pem"
        state: present
        name: "vlan1"
        description: "VLAN desc"
        type: "General Purpose (Bronze)"
        vlan_minimum: 35
        vlan_maximum: 40
      tags: create_vlan_range
      delegate_to: localhost

    - name: Create a VLAN with a single value
      dellemc.openmanage.ome_network_vlan:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        ca_path: "/path/to/ca_cert.pem"
        state: present
        name: "vlan2"
        description: "VLAN desc"
        type: "General Purpose (Bronze)"
        vlan_minimum: 127
        vlan_maximum: 127
      tags: create_vlan_single
      delegate_to: localhost

    - name: Modify a VLAN
      dellemc.openmanage.ome_network_vlan:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        ca_path: "/path/to/ca_cert.pem"
        state: present
        name: "vlan1"
        new_name: "vlan_gold1"
        description: "new description"
        type: "General Purpose (Gold)"
        vlan_minimum: 45
        vlan_maximum: 50
      tags: modify_vlan
      delegate_to: localhost

    - name: Delete a VLAN
      dellemc.openmanage.ome_network_vlan:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        ca_path: "/path/to/ca_cert.pem"
        state: "absent"
        name: "vlan1"
      tags: delete_vlan
      delegate_to: localhost
