Remove all docker pxe server templates, use submodule instead

This commit is contained in:
Khue Doan 2021-02-08 08:46:28 +07:00
parent 9a7e2a2c3a
commit a49f018255
10 changed files with 29 additions and 114 deletions

View File

@ -1,9 +0,0 @@
FROM alpine:3
RUN apk add dhcp gettext
RUN touch /var/lib/dhcp/dhcpd.leases
COPY dhcpd.conf /etc/dhcp/dhcpd.conf
CMD [ "dhcpd", "-f", "-cf", "/etc/dhcp/dhcpd.conf" ]

View File

@ -1,12 +0,0 @@
version: "3"
services:
dhcp:
build: ./dhcp
network_mode: host
tftp:
build: ./tftp
network_mode: host
http:
build: ./http
network_mode: host

View File

@ -1,3 +0,0 @@
FROM nginx:1.19-alpine
COPY ./kickstart /usr/share/nginx/html/kickstart

View File

@ -1,7 +0,0 @@
FROM alpine:3
RUN apk add tftp-hpa
COPY ./tftpboot /var/lib/tftpboot
CMD [ "in.tftpd", "--foreground", "--secure", "/var/lib/tftpboot" ]

View File

@ -1,3 +1,29 @@
- name: Start PXE server
community.general.docker_compose:
project_src: "{{ role_path }}/files/pxe-servers"
# - name: Start PXE server
# community.general.docker_compose:
# project_src: "{{ role_path }}/files/pxe-servers"
- name: Render DHCP config
template:
src: "dhcp/dhcpd.conf.j2"
dest: "{{ role_path }}/files/dhcp/dhcpd.conf"
- name: Render GRUB config
template:
src: "tftp/tftpboot/grub.cfg.j2"
dest: "{{ role_path }}/files/tftp/tftpboot/grub.cfg"
- name: Create directories
ansible.builtin.file:
path: "{{ role_path }}/build/{{ item.path }}"
state: directory
mode: '{{ item.mode }}'
with_community.general.filetree: "{{ role_path }}/templates"
when: item.state == 'directory'
- name: Template files (explicitly skip directories in order to use the 'src' attribute)
ansible.builtin.template:
src: '{{ item.src }}'
dest: "{{ role_path }}/build/{{ item.path }}"
mode: '{{ item.mode }}'
with_community.general.filetree: "{{ role_path }}/templates"
when: item.state == 'file'

View File

@ -1,20 +0,0 @@
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
option architecture-type code 93 = unsigned integer 16;
subnet {{ subnet }} netmask {{ netmask }} {
option routers {{ routers }};
range {{ range_start }} {{ range_end }};
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
next-server {{ pxe_server }};
if option architecture-type = 00:07 {
filename "grubx64.efi";
}
}
}

View File

@ -1,53 +0,0 @@
%pre --interpreter=/bin/sh
mac=$(ip --brief link show dev {{ NETWORK_DEVICE }} | tr -s ' ' | cut -d ' ' -f 3 | sed 's/:/-/g')
curl "http://{{ PXE_SERVER }}/kickstart/config/$mac.ks" > /tmp/network.ks
%end
#version=RHEL8
ignoredisk --only-use={{ DISK }}
autopart --type=lvm
# Partition clearing information
clearpart --all --initlabel --drives={{ DISK }}
# Do not use graphical install
text
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
# Network information
%include /tmp/network.ks
repo --name="AppStream" --baseurl=http://{{ PXE_SERVER }}/CentOS/AppStream
# Use network installation
url --url="http://{{ PXE_SERVER }}/CentOS/"
# Disable Setup Agent on first boot
firstboot --disable
# Do not configure the X Window System
skipx
# System services
services --enabled="chronyd"
# System timezone
timezone Asia/Ho_Chi_Minh --isUtc
# Create user
user --groups=wheel --name={{ USERNAME }} --password={{ ENCRYPTED_PASSWORD }} --iscrypted --gecos="{{ USERNAME }}"
# Add SSH key
sshkey --username=root "{{ SSH_PUBLIC_KEY }}"
%packages
@^minimal-environment
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
reboot

View File

@ -1,2 +0,0 @@
network --bootproto=static --device={{ network_device }} --ip={{ node_ip }} --gateway={{ gateway }} --nameserver={{ dns }} --netmask={{ netmask }} --ipv6=auto --activate
network --hostname={{ node_hostname }}

View File

@ -1,5 +0,0 @@
set timeout=5
menuentry 'CentOS' {
linuxefi vmlinuz ip=dhcp inst.repo=http://{{ pxe_server }}/CentOS ks=http://{{ pxe_server }}/kickstart/centos8.ks
initrdefi initrd.img
}