Add web management UI, offline packages, WinPE consolidation, and docs
- webapp/: Flask web management app with:
- Dashboard showing image types and service status
- USB import page for WinPE deployment content
- Unattend.xml visual editor (driver paths, specialize commands,
OOBE settings, first logon commands, raw XML view)
- API endpoints for services and image management
- SETUP.md: Complete setup documentation for streamlined process
- build-usb.sh: Now copies webapp and optional WinPE images to USB
- playbook: Added webapp deployment (systemd service, Apache reverse
proxy), offline package verification, WinPE auto-import from USB
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -219,6 +219,17 @@
|
||||
loop:
|
||||
- ipxe.efi
|
||||
|
||||
- name: "Check for WinPE deployment content on USB"
|
||||
stat:
|
||||
path: "{{ usb_mount }}/images"
|
||||
register: usb_images_dir
|
||||
|
||||
- name: "Import WinPE deployment content from USB (if present)"
|
||||
shell: >
|
||||
cp -rn "{{ usb_mount }}/images/{{ item }}/"* "{{ samba_share }}/{{ item }}/" 2>/dev/null || true
|
||||
loop: "{{ image_types }}"
|
||||
when: usb_images_dir.stat.exists
|
||||
|
||||
- name: "Restart and enable services"
|
||||
systemd:
|
||||
name: "{{ item }}"
|
||||
@@ -253,6 +264,82 @@
|
||||
special_time: "reboot"
|
||||
job: "/bin/sleep 15 && /usr/bin/systemctl restart dnsmasq.service"
|
||||
|
||||
# --- Web Management App (Flask) ---
|
||||
- name: "Install pip for Python package management"
|
||||
command: apt-get install -y python3-pip python3-venv
|
||||
args:
|
||||
creates: /usr/bin/pip3
|
||||
|
||||
- name: "Create webapp directory"
|
||||
file:
|
||||
path: /opt/pxe-webapp
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: "Copy webapp from USB"
|
||||
shell: >
|
||||
cp -r "{{ usb_mount }}/../webapp/"* /opt/pxe-webapp/ 2>/dev/null ||
|
||||
cp -r "{{ usb_mount }}/webapp/"* /opt/pxe-webapp/ 2>/dev/null || true
|
||||
args:
|
||||
creates: /opt/pxe-webapp/app.py
|
||||
|
||||
- name: "Create Python virtual environment for webapp"
|
||||
command: python3 -m venv /opt/pxe-webapp/venv
|
||||
args:
|
||||
creates: /opt/pxe-webapp/venv/bin/python
|
||||
|
||||
- name: "Install webapp Python dependencies"
|
||||
pip:
|
||||
requirements: /opt/pxe-webapp/requirements.txt
|
||||
virtualenv: /opt/pxe-webapp/venv
|
||||
|
||||
- name: "Create systemd service for PXE webapp"
|
||||
copy:
|
||||
dest: /etc/systemd/system/pxe-webapp.service
|
||||
content: |
|
||||
[Unit]
|
||||
Description=PXE Server Web Management
|
||||
After=network.target apache2.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/pxe-webapp
|
||||
Environment=SAMBA_SHARE={{ samba_share }}
|
||||
ExecStart=/opt/pxe-webapp/venv/bin/python app.py
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
- name: "Enable and start PXE webapp service"
|
||||
systemd:
|
||||
name: pxe-webapp
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
||||
- name: "Configure Apache reverse proxy for webapp"
|
||||
copy:
|
||||
dest: /etc/apache2/sites-available/pxe-webapp.conf
|
||||
content: |
|
||||
<VirtualHost *:80>
|
||||
ProxyPreserveHost On
|
||||
ProxyPass /manage http://127.0.0.1:5000/
|
||||
ProxyPassReverse /manage http://127.0.0.1:5000/
|
||||
</VirtualHost>
|
||||
|
||||
- name: "Enable Apache proxy modules"
|
||||
command: a2enmod proxy proxy_http
|
||||
args:
|
||||
creates: /etc/apache2/mods-enabled/proxy.load
|
||||
|
||||
- name: "Enable webapp Apache site"
|
||||
command: a2ensite pxe-webapp.conf
|
||||
args:
|
||||
creates: /etc/apache2/sites-enabled/pxe-webapp.conf
|
||||
|
||||
- name: "Configure static IP for PXE interface"
|
||||
copy:
|
||||
dest: /etc/netplan/50-cloud-init.yaml
|
||||
|
||||
Reference in New Issue
Block a user