OPNsense Forum

English Forums => General Discussion => Topic started by: lbh74 on August 28, 2024, 02:08:34 PM

Title: OPNsense automated install/setup, cloud-init, ansible, terraform, etc.
Post by: lbh74 on August 28, 2024, 02:08:34 PM
Hi all.

So I need to deploy OPNSense on Proxmox and I need to do it in multiple environments. I also need to be able to (relatively) quickly breakdown and rebuilt each environment. FYI, OPNsense/HAproxy will act as an entry point to a  Kubernetes cluster behind it (on the same Proxmox cluster), it is quite a critical component.

I've got the whole thing automated using Ansible and Terraform (setup of Proxmox, deployment of VM's, install of Kubernetes, all the apps/containers, etc).

The only thing left is OPNsense, which can only be setup manually via the console. I did some searching, looked at FreeBSD cloud-init support, which is not great yet. So I kind of gave up on that for now, but I would be happy if at least I can boot an OPNsense image which would read some kind of setup file (like docker compose, cloud-init, helm chart, etc) to get an IP address and a SSH public key so I can reach it over the network and use Ansible or even Expect to do the rest. But unfortunately I can't figure out if this is possible. Any help/ideas is/are appreciated.
Title: Re: OPNsense automated install/setup, cloud-init, ansible, terraform, etc.
Post by: Patrick M. Hausen on August 28, 2024, 02:19:33 PM
You can prepare the config.xml file with interface settings, users, ...

See my Vagrant project for some inspiration.

https://github.com/punktDe/vagrant-opnsense
Title: Re: OPNsense automated install/setup, cloud-init, ansible, terraform, etc.
Post by: lbh74 on August 28, 2024, 03:35:53 PM
I had found your project, but dismissed it on account of it being Vagrant. Ill look into the config.xml part. Thank you.
Title: Re: OPNsense automated install/setup, cloud-init, ansible, terraform, etc.
Post by: Patrick M. Hausen on August 28, 2024, 03:45:26 PM
The relevant parts are all bourne shell - hidden inside the Vagrantfile  :)