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
dhcpd.conf template does not render #48
Comments
What is the path of your DHCP config file, is it Also can you post a link to your code, I don't see it on your profile. |
Full path is as you expected Hadn't pushed my code previously as I was just trying to get it to work. Just pushed to 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. 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
} |
Does running the playbook with |
It also renders fine on my machine. |
Not really. I compared the task for |
Is it a clean VM? I can't replicate the issue so the VM might be the problem. |
That's a fair point. I can definitely try a different one. A side question -- Thanks for your time! |
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) |
Seem like you got it working ahgraber/homelab-infra@426ff06, closing. |
…from renovate/all-minor-patch into master Reviewed-on: https://git.zanelab.com/zhala/homelab/pulls/48
…oan#48) from renovate/all-minor-patch into master Reviewed-on: https://git.qos.cc/ops/homelab/pulls/48
I'm working through your netboot solution, and I have an interesting issue where dhcpd.conf.j2 does not render properly (no variables are substituted). All of the other templates work just fine, and the variables used in dhcpd.conf.j2 are available if I run a debug step:
Do you have any thoughts?
The text was updated successfully, but these errors were encountered: