---
- name: Configure the iDRAC network attributes
  hosts: idrac
  gather_facts: false

  tasks:
    - name: Register iDRAC on DNS
      dellemc.openmanage.idrac_network:
        idrac_ip: "{{ idrac_ip }}"
        idrac_user: "{{ idrac_user }}"
        idrac_password: "{{ idrac_password }}"
        ca_path: "/path/to/ca_cert.pem"
        register_idrac_on_dns: "Enabled"
        dns_idrac_name: "idrac-3CZWCK2"
        auto_config: "Enabled"
        static_dns: "dell.com"
      delegate_to: localhost
      tags:
        - dns_register

    - name: Setup VLAN attributes
      dellemc.openmanage.idrac_network:
        idrac_ip: "{{ idrac_ip }}"
        idrac_user: "{{ idrac_user }}"
        idrac_password: "{{ idrac_password }}"
        ca_path: "/path/to/ca_cert.pem"
        setup_idrac_nic_vlan: "Enabled"
      delegate_to: localhost
      tags:
        - setup_vlan

    - name: Setup iDRAC NIC
      dellemc.openmanage.idrac_network:
        idrac_ip: "{{ idrac_ip }}"
        idrac_user: "{{ idrac_user }}"
        idrac_password: "{{ idrac_password }}"
        ca_path: "/path/to/ca_cert.pem"
        enable_nic: "Enabled"
        nic_selection: "Dedicated"
        failover_network: "T_None"
        auto_detect: "Disabled"
        auto_negotiation: "Enabled"
        network_speed: "T_1000"
        duplex_mode: "Full"
      delegate_to: localhost
      tags:
        - idrac_nic

    - name: Setup iDRAC IPv4
      dellemc.openmanage.idrac_network:
        idrac_ip: "{{ idrac_ip }}"
        idrac_user: "{{ idrac_user }}"
        idrac_password: "{{ idrac_password }}"
        ca_path: "/path/to/ca_cert.pem"
        enable_dhcp: "Enabled"
        dns_from_dhcp: "Enabled"
        enable_ipv4: "Enabled"
      delegate_to: localhost
      tags:
        - idrac_ipv4

    - name: Setup iDRAC Static IPv4
      dellemc.openmanage.idrac_network:
        idrac_ip: "{{ idrac_ip }}"
        idrac_user: "{{ idrac_user }}"
        idrac_password: "{{ idrac_password }}"
        ca_path: "/path/to/ca_cert.pem"
        dns_from_dhcp: "Disabled"
      delegate_to: localhost
      tags:
        - idrac_staticipv4
