OPNsense Forum

Archive => 19.7 Legacy Series => Topic started by: bruteforce on November 25, 2019, 07:38:25 pm

Title: Automating install process
Post by: bruteforce on November 25, 2019, 07:38:25 pm
Hey, I have spent a lot of time trying to get full automated installation of opnsense. Since OPNsense is based on FreeBSD (but comes with different rc scripts), I still suppose that there must be a way how to get a fully automated installation process.
What I want - use only a bsdinstaller file like below, in other words, I need to install basic OPNsense because other configuration is an Ansible job.

Code: [Select]
#!fai
 
NONINTERACTIVE="YES"
KEYMAP="en_US"
MIRROR="ftp://ftp.fi.freebsd.org/pub/FreeBSD/"
# RELDIR snapshots or releases
RELDIR="snapshots"
# 9.3-STABLE, 10.0-STABLE or 11.0-CURRENT when RELDIR="snapshots"
# 9.1-RELEASE, 9.2-RELEASE, 9.3-RELEASE and 10.0-RELEASE when RELDIR="releases"
RELEASE="11.0-CURRENT"
# daemons to run on startup, if not set ssh will enable
DISTRIBUTIONS="kernel.txz base.txz"
# default YES
IPV4="YES"
# default YES
DHCP="YES"
# manual resolver configuration:
DNS1="1.1.1.1"
# Partitioning
PARTITIONS="da0 { auto freebsd-ufs /}"
############################# next is for /etc/rc.local #############################
#!/bin/sh

commands for rc.conf

The file above works for FreeBSD as I have already mentioned. But it gets stuck when tried on OPNsense.
Questions:
1) Have options such as MIRROR, RELEASE etc. that can be given to opnsense-installer been documented anywhere?
2) Is there a way to automate questions such as: Which hdd to use?, ie. to run opnsense-installer with parameters? It means to boot to a single user mode and fetch a file containing those commands.

Another possible way could be to copy the backup file (generated on installed OS) into an iso install file but this solution only covers configuration of OPNsense firewall and it doesn't solve installation at all.
Further, it is possible to install freebsd and then bootstrap opnsense installation as described here: https://github.com/opnsense/update#opnsense-bootstrap (https://github.com/opnsense/update#opnsense-bootstrap) but this kind of weird.

To be honest, I have found a way to "automate it" via packer boot command but it too much depends on storage speed.

Releated links:
1) https://github.com/opnsense/core/issues/18
2) https://forum.opnsense.org/index.php?topic=8552.0 - more about API

I'll appreciate any help.
All the best.