Feature #18148

Report DHCP/DNS name and domain via facts on the image

Added by Lukas Zapletal 5 months ago. Updated 3 months ago.

Status:Closed
Priority:Normal
Assigned To:Lukas Zapletal
Category:Image
Target version:Image 3.4.0
Difficulty:trivial Pull request:https://github.com/theforeman/foreman-discovery-image/pull/84
Bugzilla link:1417859
Story points-
Velocity based estimate-

Description

Some users prefer to keep the DHCP hostname when re-discovering existing hosts. We need to report these values:

[lzap@lzapx ~]$ nmcli -t -f DHCP4.OPTION c show eth0
DHCP4.OPTION[1]:requested_classless_static_routes = 1
DHCP4.OPTION[2]:requested_rfc3442_classless_static_routes = 1
DHCP4.OPTION[3]:subnet_mask = 255.255.255.0
DHCP4.OPTION[4]:requested_subnet_mask = 1
DHCP4.OPTION[5]:domain_name_servers = 192.168.1.1
DHCP4.OPTION[6]:ip_address = 192.168.1.100
DHCP4.OPTION[7]:filename = pxelinux.0
DHCP4.OPTION[8]:requested_static_routes = 1
DHCP4.OPTION[9]:dhcp_server_identifier = 192.168.1.1
DHCP4.OPTION[10]:requested_nis_servers = 1
DHCP4.OPTION[11]:requested_time_offset = 1
DHCP4.OPTION[12]:broadcast_address = 192.168.1.255
DHCP4.OPTION[13]:requested_interface_mtu = 1
DHCP4.OPTION[14]:dhcp_rebinding_time = 37800
DHCP4.OPTION[15]:requested_domain_name_servers = 1
DHCP4.OPTION[16]:dhcp_message_type = 5
DHCP4.OPTION[17]:requested_broadcast_address = 1
DHCP4.OPTION[18]:routers = 192.168.1.1
DHCP4.OPTION[19]:dhcp_renewal_time = 21600
DHCP4.OPTION[20]:requested_domain_name = 1
DHCP4.OPTION[21]:domain_name = home.lan
DHCP4.OPTION[22]:requested_routers = 1
DHCP4.OPTION[23]:expiry = 1484850701
DHCP4.OPTION[24]:requested_wpad = 1
DHCP4.OPTION[25]:host_name = lzapx
DHCP4.OPTION[26]:requested_nis_domain = 1
DHCP4.OPTION[27]:requested_ms_classless_static_routes = 1
DHCP4.OPTION[28]:network_number = 192.168.1.0
DHCP4.OPTION[29]:requested_domain_search = 1
DHCP4.OPTION[30]:next_server = 192.168.1.1
DHCP4.OPTION[31]:requested_ntp_servers = 1
DHCP4.OPTION[32]:dhcp_lease_time = 43200
DHCP4.OPTION[33]:requested_host_name = 1

Let's simply report them all for each individual interface via facter.

Associated revisions

Revision 4291ca7f
Added by Lukas Zapletal 3 months ago

Fixes #18148 - send DHCP and DNS-PTR facts

History

#1 Updated by Lukas Zapletal 5 months ago

  • Subject changed from Report DHCP name and domain via facts on the image to Report DHCP/DNS name and domain via facts on the image

Would it be possible to return a fact based off of DNS resolution from whatever the DHCP server gives out for an IP? Something like:

host `ifconfig -a | grep "inet " | awk '{print $2}' | grep -v 127.0.0.1` | grep arpa | awk '{print $5}' | awk -F. '{print $1}'

I will implement this as part of this patch as well.

#2 Updated by Lukas Zapletal 5 months ago

  • Bugzilla link set to 1417859

#3 Updated by Lukas Zapletal 4 months ago

  • Target version set to Image 3.4.0

#4 Updated by Lukas Zapletal 3 months ago

Another Red Hat customer would like to have DNS A and PTR record to be reported.

#5 Updated by Lukas Zapletal 3 months ago

  • Difficulty set to trivial

#6 Updated by Lukas Zapletal 3 months ago

Created initial patch that adds this information to facts:

nmprimary_connection_id -> eth0
nmprimary_connection_uuid -> 707abde8-c932-4645-bf38-4f415b996328
nmprimary_connection_stable-id -> --
nmprimary_connection_interface-name -> --
nmprimary_connection_type -> 802-3-ethernet
nmprimary_connection_autoconnect -> yes
nmprimary_connection_autoconnect-priority -> 0
nmprimary_connection_timestamp -> 1489406257
nmprimary_connection_read-only -> no
nmprimary_connection_permissions -> 
nmprimary_connection_zone -> --
nmprimary_connection_master -> --
nmprimary_connection_slave-type -> --
nmprimary_connection_autoconnect-slaves -> -1 (default)
nmprimary_connection_secondaries -> 
nmprimary_connection_gateway-ping-timeout -> 0
nmprimary_connection_metered -> unknown
nmprimary_connection_lldp -> -1 (default)
nmprimary_802-3-ethernet_port -> --
nmprimary_802-3-ethernet_speed -> 0
nmprimary_802-3-ethernet_duplex -> --
nmprimary_802-3-ethernet_auto-negotiate -> yes
nmprimary_802-3-ethernet_mac-address -> 3C:97:0E:B1:3E:B7
nmprimary_802-3-ethernet_cloned-mac-address -> --
nmprimary_802-3-ethernet_generate-mac-address-mask -> --
nmprimary_802-3-ethernet_mac-address-blacklist -> 
nmprimary_802-3-ethernet_mtu -> auto
nmprimary_802-3-ethernet_s390-subchannels -> 
nmprimary_802-3-ethernet_s390-nettype -> --
nmprimary_802-3-ethernet_s390-options -> 
nmprimary_802-3-ethernet_wake-on-lan -> 1 (default)
nmprimary_802-3-ethernet_wake-on-lan-password -> --
nmprimary_ipv4_method -> auto
nmprimary_ipv4_dns -> 
nmprimary_ipv4_dns-search -> 
nmprimary_ipv4_dns-options -> (default)
nmprimary_ipv4_dns-priority -> 0
nmprimary_ipv4_addresses -> 
nmprimary_ipv4_gateway -> --
nmprimary_ipv4_routes -> 
nmprimary_ipv4_route-metric -> -1
nmprimary_ipv4_ignore-auto-routes -> no
nmprimary_ipv4_ignore-auto-dns -> no
nmprimary_ipv4_dhcp-client-id -> --
nmprimary_ipv4_dhcp-timeout -> 0
nmprimary_ipv4_dhcp-send-hostname -> yes
nmprimary_ipv4_dhcp-hostname -> --
nmprimary_ipv4_dhcp-fqdn -> --
nmprimary_ipv4_never-default -> no
nmprimary_ipv4_may-fail -> yes
nmprimary_ipv4_dad-timeout -> -1 (default)
nmprimary_ipv6_method -> ignore
nmprimary_ipv6_dns -> 
nmprimary_ipv6_dns-search -> 
nmprimary_ipv6_dns-options -> (default)
nmprimary_ipv6_dns-priority -> 0
nmprimary_ipv6_addresses -> 
nmprimary_ipv6_gateway -> --
nmprimary_ipv6_routes -> 
nmprimary_ipv6_route-metric -> -1
nmprimary_ipv6_ignore-auto-routes -> no
nmprimary_ipv6_ignore-auto-dns -> no
nmprimary_ipv6_never-default -> no
nmprimary_ipv6_may-fail -> yes
nmprimary_ipv6_ip6-privacy -> 0 (disabled)
nmprimary_ipv6_addr-gen-mode -> stable-privacy
nmprimary_ipv6_dhcp-send-hostname -> yes
nmprimary_ipv6_dhcp-hostname -> --
nmprimary_ipv6_token -> --
nmprimary_general_name -> eth0
nmprimary_general_uuid -> 707abde8-c932-4645-bf38-4f415b996328
nmprimary_general_devices -> enp0s25
nmprimary_general_state -> activated
nmprimary_general_default -> yes
nmprimary_general_default6 -> no
nmprimary_general_vpn -> no
nmprimary_general_zone -> --
nmprimary_general_dbus-path -> /org/freedesktop/NetworkManager/ActiveConnection/6
nmprimary_general_con-path -> /org/freedesktop/NetworkManager/Settings/25
nmprimary_general_spec-object -> /
nmprimary_general_master-path -> --
nmprimary_ip4_address -> 192.168.1.100/24
nmprimary_ip4_gateway -> 192.168.1.1
nmprimary_ip4_dns -> 192.168.1.1
nmprimary_ip4_domain -> home.lan
nmprimary_dhcp4_option_requested_classless_static_routes -> 1
nmprimary_dhcp4_option_requested_rfc3442_classless_static_routes -> 1
nmprimary_dhcp4_option_subnet_mask -> 255.255.255.0
nmprimary_dhcp4_option_requested_subnet_mask -> 1
nmprimary_dhcp4_option_domain_name_servers -> 192.168.1.1
nmprimary_dhcp4_option_ip_address -> 192.168.1.100
nmprimary_dhcp4_option_filename -> pxelinux.0
nmprimary_dhcp4_option_requested_static_routes -> 1
nmprimary_dhcp4_option_dhcp_server_identifier -> 192.168.1.1
nmprimary_dhcp4_option_requested_nis_servers -> 1
nmprimary_dhcp4_option_requested_time_offset -> 1
nmprimary_dhcp4_option_broadcast_address -> 192.168.1.255
nmprimary_dhcp4_option_requested_interface_mtu -> 1
nmprimary_dhcp4_option_dhcp_rebinding_time -> 37800
nmprimary_dhcp4_option_requested_domain_name_servers -> 1
nmprimary_dhcp4_option_dhcp_message_type -> 5
nmprimary_dhcp4_option_requested_broadcast_address -> 1
nmprimary_dhcp4_option_routers -> 192.168.1.1
nmprimary_dhcp4_option_dhcp_renewal_time -> 21600
nmprimary_dhcp4_option_requested_domain_name -> 1
nmprimary_dhcp4_option_domain_name -> home.lan
nmprimary_dhcp4_option_requested_routers -> 1
nmprimary_dhcp4_option_expiry -> 1489432361
nmprimary_dhcp4_option_requested_wpad -> 1
nmprimary_dhcp4_option_host_name -> lzapx
nmprimary_dhcp4_option_requested_nis_domain -> 1
nmprimary_dhcp4_option_requested_ms_classless_static_routes -> 1
nmprimary_dhcp4_option_network_number -> 192.168.1.0
nmprimary_dhcp4_option_requested_domain_search -> 1
nmprimary_dhcp4_option_next_server -> 192.168.1.1
nmprimary_dhcp4_option_requested_ntp_servers -> 1
nmprimary_dhcp4_option_dhcp_lease_time -> 43200
nmprimary_dhcp4_option_requested_host_name -> 1
nmprimary_ip6_address -> fd5a:f687:b576:0:3e97:eff:feb1:3eb7/64
nmprimary_ip6_address -> fe80::3e97:eff:feb1:3eb7/64
nmprimary_ip6_gateway -> 

#7 Updated by The Foreman Bot 3 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Lukas Zapletal
  • Pull request https://github.com/theforeman/foreman-discovery-image/pull/84 added

#8 Updated by Anonymous 3 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF