Skip to content

nmcli fails to update DNS servers #4373

@anandb-ripencc

Description

@anandb-ripencc

Summary

I'm trying to use the nmcli module to set DNS servers for a connection, but it's failing with an error message about the IPv4 gateway.

Issue Type

Bug Report

Component Name

nmcli

Ansible Version

$ ansible --version
ansible [core 2.12.3]
  config file = /Users/anandb/repo/rootsorg/config/ansible/ansible.cfg
  configured module search path = ['/Users/anandb/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/anandb/.virtualenvs/ansible_latest/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/anandb/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/anandb/.virtualenvs/ansible_latest/bin/ansible
  python version = 3.10.2 (main, Feb  2 2022, 08:42:42) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.0.3
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /Users/anandb/.virtualenvs/ansible_latest/lib/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 4.6.0

Configuration

$ ansible-config dump --only-changed
DEFAULT_HOST_LIST(/Users/anandb/repo/rootsorg/config/ansible/ansible.cfg) = ['/Users/anandb/repo/rootsorg/config/ansible/hosts']
DEFAULT_TIMEOUT(env: ANSIBLE_TIMEOUT) = 60

OS / Environment

The target OS is an up to date CentOS 7 system

Steps to Reproduce

ansible HOST -m nmcli -a "conn_name=em1 type=ethernet state=present dns6='::1 2620:fe::fe'"

Expected Results

I expected the task to run successfully, and update the DNS servers if necessary.

Actual Results

HOST | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "msg": "Error: Failed to modify connection 'em1': ipv4.gateway: gateway cannot be set if there are no addresses configured\n",
    "name": "em1",
    "rc": 1
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bugmodulemodulenet_toolspluginsplugin (any type)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions