HewlettPackard / oneview-ansible-collection

Ansible Collection and Sample Playbooks for HPE OneView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Appliance network settings - updating DNS fails

ClaireHayard opened this issue · comments

Scenario/Intent

Hello,

I am trying to update the DNS settings in the network appliance of OneView however I am getting an error when running the playbook. Am I missing something necessary for the task ?

main.yml

- name: Update dns servers of the network interface
  hpe.oneview.oneview_appliance_network_interfaces:
    state: present
    hostname: "{{ oneview_hostname }}"
    username: "{{ oneview_username }}"
    password: "{{ oneview_password }}"
    auth_login_domain: "{{ oneview_auth_login_domain }}"
    api_version: "{{ oneview_api_version }}"
    data:
      macAddress: "{{ macAddress }}"
      ipv4NameServers: "{{ network_settings }}"
  delegate_to: localhost

Example of input DNS settings: network_settings: ["firstIpAddress", "secondIpAddress"]

Environment Details

  • OneView Ansible Collection: v6.6.0
  • OneView Appliance Version: 6.10
  • Ansible version: 2.9.6
  • Python version: 3.8.10

Expected Result

The DNS (preferred or alternate) ips are updated with the correct input.

Actual Result

raise HPEOneViewTaskError(msg, error_code)\nhpeOneView.exceptions.HPEOneViewTaskError: Supplied IP address <ip @ of the OneView> is duplicate for one or more fields.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP *******************************************************************************************************************************
localhost                  : ok=4    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0 

Hello, any news on this ?

Hi Claire,

I tried updating DNS settings in the network appliance of OneView similar to the network settings that you have provided above. I didn’t get any error and I could see the updated DNS settings in OneView. Please find my playbook snippet below.

../oneview-ansible-collection/roles/oneview_appliance_network_interfaces/tasks/main.yml

  • name: Updates dns servers of the network interface
    oneview_appliance_network_interfaces:
    config: "{{ config }}"
    state: present
    data:
    macAddress: "{{mac_address}}"
    ipv4NameServers: "{{network_settings}}"
    delegate_to: localhost
  • debug: var=appliance_network_interfaces

../oneview-ansible-collection/roles/oneview_appliance_network_interfaces/defaults/main.yml
network_settings: ["x.x.x.x","x.x.x.x"]

Hello @alisha-k-kalladassery,

I am getting this error when I try to modify one the IP adresses after the first (successful) run of the playbook. In your example, if I change network_settings: ["16.110.135.51","16.110.135.52"] to network_settings: ["16.110.135.51","16.110.135.53"] for example, that's when I get the above error. Maybe that's because I am putting a wrong IP address ?

Hi Claire,

We are not able to reproduce the issue. Could you please share more details and the entire playbook which you tried.
Were you getting any errors in OneView UI? Also, Could you try if you are able to do the same manually from OneView UI?

Hi Claire,
As discussed, issue is not due to the dns update rather it is caused by the oneview ip and associated configuration. We couldn't reproduce the issue with the code snippet you shared. Please let us know if you need any further help on this.

Closing this issue as the mentioned issue is not caused due to the Dns update.