Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible_dns.nameservers doesn't reflect real name servers for Ubuntu and Photon OS #56772

Closed
keirazhang opened this issue May 22, 2019 · 6 comments
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bot_closed bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category

Comments

@keirazhang
Copy link

SUMMARY

On Ubuntu 19.04 and Photon OS 3.0, the ansible_dns.nameservers is always ["127.0.0.53"]. But if run "systemd-resolve --status", a different DNS servers list could be get. Take Photon OS 3.0 as an example, below is the output of "systemd-resolve --status"

# systemd-resolve --status
Global
       LLMNR setting: no
MulticastDNS setting: yes
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
Fallback DNS Servers: 8.8.8.8
                      8.8.4.4
                      2001:4860:4860::8888
                      2001:4860:4860::8844
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa
                      29.172.in-addr.arpa
                      30.172.in-addr.arpa
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 2 (eth0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
  Current DNS Server: 10.117.0.1
         DNS Servers: 10.117.0.1
                      10.111.0.1
                      10.112.16.131
          DNS Domain: eng.vmware.com
                      vmware.com

But its ansible_facts doesn't reflect these real name servers:

        "ansible_distribution": "VMware Photon OS", 
        "ansible_distribution_file_parsed": true, 
        "ansible_distribution_file_path": "/etc/os-release", 
        "ansible_distribution_file_variety": "NA", 
        "ansible_distribution_major_version": "3", 
        "ansible_distribution_release": "NA", 
        "ansible_distribution_version": "3.0", 
        "ansible_dns": {
            "nameservers": [
                "127.0.0.53"
            ], 
            "search": [
                "eng.vmware.com", 
                "vmware.com"
            ]
        }, 
ISSUE TYPE
  • Bug Report
COMPONENT NAME

setup

ANSIBLE VERSION
ansible 2.9.0.dev0
  config file = /home/qiz/workspace/Ansible/testcase/ansible.cfg
  configured module search path = [u'/home/qiz/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/qiz/workspace/github/ansible/lib/ansible
  executable location = /home/qiz/workspace/github/ansible/bin/ansible
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]

CONFIGURATION
ANSIBLE_SSH_RETRIES(/home/qiz/workspace/Ansible/testcase/ansible.cfg) = 5
DEFAULT_BECOME(/home/qiz/workspace/Ansible/testcase/ansible.cfg) = True
DEFAULT_BECOME_ASK_PASS(/home/qiz/workspace/Ansible/testcase/ansible.cfg) = False
DEFAULT_BECOME_METHOD(/home/qiz/workspace/Ansible/testcase/ansible.cfg) = sudo
DEFAULT_BECOME_USER(/home/qiz/workspace/Ansible/testcase/ansible.cfg) = root
DEFAULT_CALLBACK_PLUGIN_PATH(/home/qiz/workspace/Ansible/testcase/ansible.cfg) = [u'/home/qiz/workspace/Ansible/testcase/plugin']
DEFAULT_HOST_LIST(/home/qiz/workspace/Ansible/testcase/ansible.cfg) = [u'/home/qiz/workspace/Ansible/testcase/hosts']
DISPLAY_SKIPPED_HOSTS(/home/qiz/workspace/Ansible/testcase/ansible.cfg) = False
HOST_KEY_CHECKING(/home/qiz/workspace/Ansible/testcase/ansible.cfg) = False
RETRY_FILES_ENABLED(/home/qiz/workspace/Ansible/testcase/ansible.cfg) = False
OS / ENVIRONMENT

Ubuntu 19.04 (should also exists with earlier version: maybe 17.10 and later)
VMware Photon OS 3.0

Because in these OS releases, /etc/resolv.conf is a symbolic link:
/etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

STEPS TO REPRODUCE
ansible host -m setup
EXPECTED RESULTS

From above Photon OS 3.0 example, ansible_dns.nameservers could get real name servers as below:

        "ansible_dns": {
            "nameservers": [
                "10.117.0.1",
                 "10.111.0.1",
                 "10.112.16.131"
            ], 
            "search": [
                "eng.vmware.com", 
                "vmware.com"
            ]
        }, 
ACTUAL RESULTS
        "ansible_dns": {
            "nameservers": [
                "127.0.0.53"
            ], 
            "search": [
                "eng.vmware.com", 
                "vmware.com"
            ]
        }, 
@ansibot
Copy link
Contributor

ansibot commented May 22, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented May 22, 2019

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category labels May 22, 2019
@samdoran samdoran added waiting_on_contributor This would be accepted but there are no plans to actively work on it. and removed needs_triage Needs a first human triage before being processed. labels May 23, 2019
@ansibot
Copy link
Contributor

ansibot commented May 16, 2020

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@nickgryg
Copy link
Contributor

nickgryg commented Aug 1, 2020

We experience this issue not because in these OS releases /etc/resolv.conf is a symbolic link:

/etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf 

It's because systemd-resolved which provides network name resolution to local applications is only defined in /etc/resolv.conf:

# cat /run/systemd/resolve/stub-resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0
search home

ansible gets information only from /etc/resolv.conf currently. So, that's fair enough we have the following facts:

        "ansible_dns": {
            "nameservers": [
                "127.0.0.53"
            ],
            "options": {
                "edns0": true
            },
            "search": [
                "home"
            ]
        },

@igoratencompass
Copy link

@nickgryg and that is the whole point, when ansible sees nameserver 127.0.0.53 it should understand this is systemd-resolved stub domain and proceed reading the /run/systemd/resolve/resolv.conf for the real DNS servers.

@ansibot
Copy link
Contributor

ansibot commented Apr 12, 2022

Thank you very much for your submission to Ansible. It means a lot to us that you've taken time to contribute.

Unfortunately, this issue has been open for some time while waiting for a contributor to take it up but there does not seem to have been anyone that did so. So we are going to close this issue to clear up the queues and make it easier for contributors to browse possible implementation targets.

However, we're absolutely always up for discussion. Because this project is very active, we're unlikely to see comments made on closed tickets and we lock them after some time. If you or anyone else has any further questions, please let us know by using any of the communication methods listed in the page below:

In the future, sometimes starting a discussion on the development list prior to proposing or implementing a feature can make getting things included a little easier, but it's not always necessary.

Thank you once again for this and your interest in Ansible!

click here for bot help

@ansibot ansibot added bot_closed and removed waiting_on_contributor This would be accepted but there are no plans to actively work on it. labels Apr 12, 2022
@ansibot ansibot closed this as completed Apr 12, 2022
@ansible ansible locked and limited conversation to collaborators Apr 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bot_closed bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category
Projects
None yet
Development

No branches or pull requests

5 participants