opn_haproxy_add
Create a new HAProxy resource such as frontend, backend, server, ACL, or health check for OPNsense. Specify config fields; changes apply after validation and reconfigure.
Instructions
Create a new HAProxy resource.
Use this to add frontends, backends, servers, actions, ACLs, health checks, error files, resolvers, or mailers.
The config dict contains field name-value pairs. Only specify fields you want to set — the API fills in defaults for omitted fields.
Health check example:
config={"name": "hc_web", "type": "http", "interval": "5000", "checkport": "8080", "http_method": "get", "http_uri": "/", "http_version": "http11"}
For apps returning non-2xx (e.g. 401 behind auth), add: "http_expressionEnabled": "1", "http_expression": "rstatus", "http_value": "^[2-4][0-9]{2}$"
After creating, link to a backend with opn_haproxy_update: config={"healthCheck": ""}
IPv6 examples:
Frontend bind: config={"name": "web-v6", "bind": "[::]:443,0.0.0.0:443", "mode": "http", "ssl_enabled": "1", "defaultBackend": ""}
Server address: config={"name": "srv1", "address": "2001:db8::1", "port": "8080"}
Backend resolvePrefer: config={"name": "pool1", "mode": "http", "algorithm": "roundrobin", "resolvePrefer": "ipv6"}
NOTE: Changes are NOT applied until you call opn_reconfigure_haproxy. Call opn_haproxy_configtest first to validate the configuration.
Returns: dict with 'result' (str) and 'uuid' (str) of the new resource.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resource_type | Yes | ||
| config | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||