GithubHelp home page GithubHelp logo

Comments (9)

khuedoan avatar khuedoan commented on June 30, 2024

What is the path of your DHCP config file, is it metal/roles/pxe_server/files/data/pxe-config/dhcpd.conf, can you post the full file in that path?

Also can you post a link to your code, I don't see it on your profile.

from homelab.

ahgraber avatar ahgraber commented on June 30, 2024

Full path is as you expected metal/roles/pxe_server/files/data/pxe-config/dhcpd.conf

Hadn't pushed my code previously as I was just trying to get it to work. Just pushed to metal branch

A bit more background -- previously I had been trying to run this on an Ubuntu VM I'm using as a jump box so it's in the same subnet as my lab. The dhcpd.conf does not render on the VM. However, if I try on my local machine, it does render correctly. It's weird because the grub.cfg template works fine on the VM.
Is there a dependency I might be missing on the VM?

dhcpd.conf with missing substitutions:

subnet {{ ansible_default_ipv4.network }} netmask {{ ansible_default_ipv4.netmask }} {
    option routers {{ ansible_default_ipv4.gateway }};
    range {{ ansible_default_ipv4.network | ansible.netcommon.ipmath(1) }} {{ ansible_default_ipv4.broadcast | ansible.netcommon.ipmath(-1) }};

    class "pxeclients" {
        match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
        next-server {{ ansible_default_ipv4.address }};

        if option architecture-type = 00:07 {
            filename "grubx64.efi";
        }
    }
}

grub.cfg with successful substitutions:

menuentry 'ubuntu-20.04.3-live-server-amd64 (autoinstall)' --id=autoinstall {
    echo "Loading Kernel..."
    linux vmlinuz \
        ip=dhcp \
        url=http://10.2.1.100/iso/ubuntu-20.04.3-live-server-amd64.iso autoinstall \
        ds="nocloud-net;seedfrom=http://10.2.1.100/" root=/dev/ram0 cloud-config-url=/dev/null
    echo "Loading Ram Disk..."
    initrd initrd
}

from homelab.

khuedoan avatar khuedoan commented on June 30, 2024

Does running the playbook with -vvv show any other related info?

from homelab.

khuedoan avatar khuedoan commented on June 30, 2024

It also renders fine on my machine.

from homelab.

ahgraber avatar ahgraber commented on June 30, 2024

Does running the playbook with -vvv show any other related info?

Not really. I compared the task for dhcpd.conf to the task for grub.cfg and the logs look pretty much identical aside from the different paths.

from homelab.

khuedoan avatar khuedoan commented on June 30, 2024

run this on an Ubuntu VM I'm using as a jump box

Is it a clean VM? I can't replicate the issue so the VM might be the problem.

from homelab.

ahgraber avatar ahgraber commented on June 30, 2024

Is it a clean VM?

That's a fair point. I can definitely try a different one.

A side question --
My lab subnet is 10.2.0.0/16. I have my router set up as a DHCP server for the subnet, but only service addresses in range 10.2.1.100 - 10.2.1.200.
Will running the additional dhcp server for a different IP range (10.2.118.0/24) in the lab subnet cause problems? If so, how would you advise setting things up?

Thanks for your time!

from homelab.

khuedoan avatar khuedoan commented on June 30, 2024

The current setup is tested on a flat 192.168.1.0/24 network, which is the most common case, but you can always customize the parameters of the DHCP config if needed. If you worry about the DHCP server you can add a handler for Ansible to turn off the PXE server after the machines are booted (in my case the IP range is the same with my router so it doesn't matter much)

from homelab.

khuedoan avatar khuedoan commented on June 30, 2024

Seem like you got it working ahgraber/homelab-infra@426ff06, closing.

from homelab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.