---
- hosts: ome
  connection: local
  name: Dell OpenManage Ansible smart fabric uplink configuration.
  gather_facts: False

  collections:
    - dellemc.openmanage

  tasks:
    - name: "Create a Uplink"
      ome_smart_fabric_uplink:
        hostname: "{{hostname}}"
        username: "{{username}}"
        password: "{{password}}"
        state: "present"
        fabric_name: "fabric1"
        name: "uplink1"
        description: "CREATED from OMAM"
        uplink_type: "Ethernet"
        ufd_enable: "Enabled"
        primary_switch_service_tag: "ABC1234"
        primary_switch_ports:
          - ethernet1/1/13
          - ethernet1/1/14
        secondary_switch_service_tag: "XYZ1234"
        secondary_switch_ports:
          - ethernet1/1/13
          - ethernet1/1/14
        tagged_networks:
          - vlan1
          - vlan3
        untagged_network: vlan2
      tags: create_uplink

    - name: "modify a existing uplink1"
      ome_smart_fabric_uplink:
        hostname: "{{hostname}}"
        username: "{{username}}"
        password: "{{password}}"
        state: "present"
        fabric_name: "fabric1"
        name: "uplink1"
        new_name: "uplink2"
        description: "Modified from OMAM"
        uplink_type: "Ethernet"
        ufd_enable: "Disabled"
        primary_switch_service_tag: "DEF1234"
        primary_switch_ports:
          - ethernet1/2/13
          - ethernet1/2/14
        secondary_switch_service_tag: "TUV1234"
        secondary_switch_ports:
          - ethernet1/2/13
          - ethernet1/2/14
        tagged_networks:
          - vlan11
          - vlan33
        untagged_network: vlan22
      tags: modify_uplink

    - name: "Delete a Uplink"
      ome_smart_fabric_uplink:
        hostname: "{{hostname}}"
        username: "{{username}}"
        password: "{{password}}"
        state: "absent"
        fabric_name: "fabric1"
        name: "uplink1"
      tags: delete_uplink

    - name: "Modify the Uplink name"
      ome_smart_fabric_uplink:
        hostname: "{{hostname}}"
        username: "{{username}}"
        password: "{{password}}"
        state: "present"
        fabric_name: "fabric1"
        name: "uplink1"
        new_name: "uplink2"
      tags: modify_uplink_name

    - name: "Modify a Uplink ports"
      ome_smart_fabric_uplink:
        hostname: "{{hostname}}"
        username: "{{username}}"
        password: "{{password}}"
        state: "present"
        fabric_name: "fabric1"
        name: "uplink1"
        description: "uplink ports modified"
        primary_switch_service_tag: "ABC1234"
        primary_switch_ports:
          - ethernet1/1/6
          - ethernet1/1/7
        secondary_switch_service_tag: "XYZ1234"
        secondary_switch_ports:
          - ethernet1/1/9
          - ethernet1/1/10
      tags: modify_ports

    - name: "Modify Uplink networks"
      ome_smart_fabric_uplink:
        hostname: "{{hostname}}"
        username: "{{username}}"
        password: "{{password}}"
        state: "present"
        fabric_name: "fabric1"
        name: "create1"
        description: "uplink networks modified"
        tagged_networks:
          - vlan4
      tags: modify_networks
