Changed iPXE dilvery method to HTTP, refactoring
- iPXE will download files via http instead of tftp - added more variabled for better settings handling
This commit is contained in:
parent
82b8dc4fad
commit
b5cb86950d
|
@ -10,3 +10,12 @@ server_netbits: 24
|
||||||
server_netmask: 255.255.255.0
|
server_netmask: 255.255.255.0
|
||||||
apt_cacher_offline_mode: false
|
apt_cacher_offline_mode: false
|
||||||
debian_release: buster
|
debian_release: buster
|
||||||
|
|
||||||
|
fai_configdir: /srv/fai/config
|
||||||
|
fai_profiles_archive: "config.tar"
|
||||||
|
fai_squashfs_file: "squash.img"
|
||||||
|
|
||||||
|
tftp_dir: "/srv/tftp/fai"
|
||||||
|
http_mirror_ipxe_path_prefix: "ipxe"
|
||||||
|
http_mirror_fai_path_prefix: "fai"
|
||||||
|
|
||||||
|
|
|
@ -19,3 +19,4 @@
|
||||||
group: root
|
group: root
|
||||||
content: |
|
content: |
|
||||||
LOGUSER=root
|
LOGUSER=root
|
||||||
|
FAI_CONFIGDIR={{ fai_configdir }}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
copy:
|
copy:
|
||||||
content: |
|
content: |
|
||||||
#!ipxe
|
#!ipxe
|
||||||
|
set boot-root {{ http_mirror_ipxe_root_url }}
|
||||||
set menu-default fai
|
set menu-default fai
|
||||||
set menu-timeout 5000
|
set menu-timeout 5000
|
||||||
set submenu-timeout ${menu-timeout}
|
set submenu-timeout ${menu-timeout}
|
||||||
|
@ -64,15 +65,13 @@
|
||||||
exit
|
exit
|
||||||
|
|
||||||
:fai
|
:fai
|
||||||
kernel {{ fai_live_vmlinuz }}
|
kernel --name fai ${boot-root}/{{ fai_live_vmlinuz }} root=live:{{ http_mirror_fai_squashfs_url }} FAI_FLAGS=verbose,sshd,createv,menu FAI_CONFIG_SRC={{ http_mirror_fai_profiles_url }} FAI_ACTION=install net.ifnames=0 ip=dhcp
|
||||||
initrd {{ fai_live_initrd }}
|
imgfetch --name fai ${boot-root}/{{ fai_live_initrd }}
|
||||||
imgargs {{ fai_live_vmlinuz }} ip=dhcp root=live:http://{{ server_name }}/tftp/fai/squash.img FAI_FLAGS=verbose,sshd,createv,menu FAI_CONFIG_SRC=http://{{ server_name }}/fai/config.tar FAI_ACTION=install net.ifnames=0
|
|
||||||
boot || goto failed
|
boot || goto failed
|
||||||
goto start
|
goto start
|
||||||
|
|
||||||
:dban
|
:dban
|
||||||
kernel dban.bzi
|
kernel ${boot-root}/dban.bzi silent vga=785
|
||||||
imgargs dban.bzi silent vga=785
|
|
||||||
boot || goto failed
|
boot || goto failed
|
||||||
goto start
|
goto start
|
||||||
dest: /srv/tftp/fai/menu.ipxe
|
dest: /srv/tftp/fai/menu.ipxe
|
|
@ -13,3 +13,24 @@
|
||||||
package:
|
package:
|
||||||
name: [fai-server, squashfs-tools, ipxe]
|
name: [fai-server, squashfs-tools, ipxe]
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
- name: create fai profiles directory
|
||||||
|
file:
|
||||||
|
name: "{{ fai_configdir }}"
|
||||||
|
state: directory
|
||||||
|
mode: u=rwx,g=rx,o=rx
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
recurse: true
|
||||||
|
|
||||||
|
- name: create http download directories
|
||||||
|
file:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
mode: u=rwx,g=rx,o=rx
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
recurse: true
|
||||||
|
with_items:
|
||||||
|
- "{{ fai_download_dir }}"
|
||||||
|
- "{{ ipxe_download_dir }}"
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
group: root
|
group: root
|
||||||
mode: u=rw,g=r,o=r
|
mode: u=rw,g=r,o=r
|
||||||
|
|
||||||
- name: copy fai profile
|
- name: copy fai profiles
|
||||||
synchronize:
|
synchronize:
|
||||||
src: profiles/
|
src: profiles/
|
||||||
dest: /srv/fai/config/
|
dest: "{{ fai_configdir }}"
|
||||||
mode: push
|
mode: push
|
||||||
delete: yes
|
delete: yes
|
||||||
recursive: yes
|
recursive: yes
|
||||||
|
@ -18,13 +18,13 @@
|
||||||
- name: Set APT proxy
|
- name: Set APT proxy
|
||||||
template:
|
template:
|
||||||
src: fai-profile-00-proxy.yml
|
src: fai-profile-00-proxy.yml
|
||||||
dest: /srv/fai/config/files/etc/apt/apt.conf.d/00-proxy/HW4F_DESKTOP
|
dest: "{{ fai_configdir }}/files/etc/apt/apt.conf.d/00-proxy/HW4F_DESKTOP"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: u=rw,g=r,o=r
|
mode: u=rw,g=r,o=r
|
||||||
register: fai_profiles_apt_proxy
|
register: fai_profiles_apt_proxy
|
||||||
|
|
||||||
- name: pack fai configuration
|
- name: pack fai configuration
|
||||||
shell: tar -C /srv/fai/config -cf /srv/fai/config.tar .
|
shell: "tar -C {{ fai_configdir }} -cf {{ fai_download_dir }}/{{ fai_profiles_archive }} ."
|
||||||
when: "fai_profiles.changed or fai_profiles_apt_proxy.changed"
|
when: "fai_profiles.changed or fai_profiles_apt_proxy.changed"
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
- name: copy linux kernel and initrd to tftp root
|
- name: copy linux kernel and initrd to tftp root
|
||||||
copy:
|
copy:
|
||||||
src: "/srv/fai/nfsroot/boot/{{ item }}"
|
src: "/srv/fai/nfsroot/boot/{{ item }}"
|
||||||
dest: "/srv/tftp/fai/{{ item }}"
|
dest: "{{ ipxe_download_dir }}/{{ item }}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: u=rw,g=r,o=r
|
mode: u=rw,g=r,o=r
|
||||||
|
@ -26,25 +26,17 @@
|
||||||
|
|
||||||
- name: generate squashfs image of root files
|
- name: generate squashfs image of root files
|
||||||
stat:
|
stat:
|
||||||
path: /srv/tftp/fai/squash.img
|
path: "{{ fai_squashfs_path }}"
|
||||||
register: squash_img
|
register: squash_img
|
||||||
|
|
||||||
- name: generate a downloadable squashfs of root filesystem
|
- name: generate a downloadable squashfs of root filesystem
|
||||||
shell: fai-cd -f -M -S /srv/tftp/fai/squash.img
|
shell: "fai-cd -f -M -S {{ fai_squashfs_path }} -d {{ http_mirror_fai_profiles_url }}"
|
||||||
when: "not squash_img.stat.exists or fai_profiles.changed or fai_profiles_apt_proxy.changed"
|
when: "not squash_img.stat.exists"
|
||||||
|
|
||||||
- name: copy dban image
|
- name: copy dban image
|
||||||
copy:
|
copy:
|
||||||
src: files/dban/dban.bzi
|
src: files/dban/dban.bzi
|
||||||
dest: /srv/tftp/fai/dban.bzi
|
dest: "{{ ipxe_download_dir }}/dban.bzi"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: u=rw,g=r,o=r
|
mode: u=rw,g=r,o=r
|
||||||
|
|
||||||
- name: setup iPXE
|
|
||||||
include: fai-pxe-ipxe.yml
|
|
||||||
|
|
||||||
- name: force restart tftp server
|
|
||||||
service:
|
|
||||||
name: tftpd-hpa
|
|
||||||
state: restarted
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
- name: force restart tftp server
|
||||||
|
service:
|
||||||
|
name: tftpd-hpa
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: ensure inetd is started
|
||||||
|
service:
|
||||||
|
name: inetd
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
- name: ensure inetd is refreshed, when config changed
|
||||||
|
service:
|
||||||
|
name: inetd
|
||||||
|
state: restarted
|
||||||
|
when: inetd_conf.changed
|
||||||
|
|
||||||
|
- name: ntp is running and enabled
|
||||||
|
service:
|
||||||
|
name: ntp
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
- name: reload ntp config
|
||||||
|
service:
|
||||||
|
name: ntp
|
||||||
|
state: restarted
|
||||||
|
when: ntp_conf.changed
|
||||||
|
|
||||||
|
- name: ensure http server is running
|
||||||
|
service:
|
||||||
|
name: nginx
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
- name: ensure http server is restart after config change
|
||||||
|
systemd:
|
||||||
|
name: nginx
|
||||||
|
state: restarted
|
||||||
|
when: nginx_conf.changed
|
||||||
|
|
|
@ -26,3 +26,6 @@
|
||||||
- include: fai-profiles.yml
|
- include: fai-profiles.yml
|
||||||
- include: fai-root.yml
|
- include: fai-root.yml
|
||||||
- include: fai-pxe.yml
|
- include: fai-pxe.yml
|
||||||
|
- include: fai-ipxe.yml
|
||||||
|
- include: finish.yml
|
||||||
|
|
||||||
|
|
|
@ -9,17 +9,16 @@
|
||||||
server {
|
server {
|
||||||
listen 80 default_server;
|
listen 80 default_server;
|
||||||
listen [::]:80 default_server;
|
listen [::]:80 default_server;
|
||||||
root /srv;
|
root /var/www/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
location / {
|
location /{{ http_mirror_ipxe_path_prefix }} {
|
||||||
autoindex on;
|
autoindex on;
|
||||||
try_files $uri $uri/ =404;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location /apt-mirror {
|
location /{{ http_mirror_fai_path_prefix }} {
|
||||||
root /var/cache/apt-cacher-ng/uburep;
|
autoindex on;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dest: /etc/nginx/sites-enabled/default
|
dest: /etc/nginx/sites-enabled/default
|
||||||
|
@ -28,15 +27,21 @@
|
||||||
group: root
|
group: root
|
||||||
register: nginx_conf
|
register: nginx_conf
|
||||||
|
|
||||||
- name: ensure http server is running
|
- name: place info site
|
||||||
service:
|
copy:
|
||||||
name: nginx
|
content: |
|
||||||
state: started
|
<html>
|
||||||
enabled: true
|
<head>
|
||||||
|
<title>Hardware for Future - PXE Environment</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>This mirror is part of the <a href="https://hardwareforfuture.de/">Hardware for Future</a> project</p>
|
||||||
|
<p>Restart the computer and boot into PXE to install Ubuntu.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
- name: ensure http server is restart after config change
|
dest: /var/www/html/index.html
|
||||||
systemd:
|
mode: 0644
|
||||||
name: nginx
|
owner: root
|
||||||
state: restarted
|
group: root
|
||||||
when: nginx_conf.changed
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
- name: install inetd
|
- name: configure rdate for inetd
|
||||||
package:
|
|
||||||
name: inetutils-tools
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: activate rdate
|
|
||||||
copy:
|
copy:
|
||||||
content: |
|
content: |
|
||||||
time stream tcp nowait root internal
|
time stream tcp nowait root internal
|
||||||
|
@ -13,18 +8,10 @@
|
||||||
mode: u=rw,g=r,o=r
|
mode: u=rw,g=r,o=r
|
||||||
register: inetd_conf
|
register: inetd_conf
|
||||||
|
|
||||||
- name: ensure inetd is started
|
- name: install inetd
|
||||||
service:
|
package:
|
||||||
name: inetd
|
name: inetutils-tools
|
||||||
state: started
|
state: present
|
||||||
enabled: true
|
|
||||||
when: inetd_conf.changed
|
|
||||||
|
|
||||||
- name: ensure inetd is refreshed, when config changed
|
|
||||||
service:
|
|
||||||
name: inetd
|
|
||||||
state: restarted
|
|
||||||
when: inetd_conf.changed
|
|
||||||
|
|
||||||
- name: install ntp server
|
- name: install ntp server
|
||||||
package:
|
package:
|
||||||
|
@ -63,15 +50,3 @@
|
||||||
group: root
|
group: root
|
||||||
register: ntp_conf
|
register: ntp_conf
|
||||||
|
|
||||||
- name: ntp is running and enabled
|
|
||||||
service:
|
|
||||||
name: ntp
|
|
||||||
state: started
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- name: reload ntp config
|
|
||||||
service:
|
|
||||||
name: ntp
|
|
||||||
state: restarted
|
|
||||||
when: ntp_conf.changed
|
|
||||||
|
|
||||||
|
|
|
@ -2,3 +2,14 @@
|
||||||
# vars file for fai
|
# vars file for fai
|
||||||
|
|
||||||
server_net: "{{ server_ip |regex_replace('.[0-9]+$', '') }}"
|
server_net: "{{ server_ip |regex_replace('.[0-9]+$', '') }}"
|
||||||
|
|
||||||
|
fai_download_dir: "/var/www/html/{{ http_mirror_fai_path_prefix }}"
|
||||||
|
ipxe_download_dir: "/var/www/html/{{ http_mirror_ipxe_path_prefix }}"
|
||||||
|
fai_squashfs_path: "{{ fai_download_dir }}/{{ fai_squashfs_file }}"
|
||||||
|
|
||||||
|
http_mirror: "http://{{ server_name }}"
|
||||||
|
http_mirror_ipxe_root_url: "{{ http_mirror }}/{{ http_mirror_ipxe_path_prefix }}"
|
||||||
|
http_mirror_fai_profiles_url: "{{ http_mirror }}/{{ http_mirror_fai_path_prefix }}/{{ fai_profiles_archive }}"
|
||||||
|
http_mirror_fai_squashfs_url: "{{ http_mirror }}/{{ http_mirror_fai_path_prefix }}/{{ fai_squashfs_file }}"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue