This permit to create a templated unit inside the sandbox,
using the sandbox name as a variable and so running the same
unit with a different configuration without too much hassle.
For example, someone could have several different configuration of
website in /etc/nginx/websites.d/ and have each of them started in
a different sandbox, with a sample templated unit using the sandbox
name as a option to read the proper configuration file directly.
One could take the following file in /etc/systemd/system/nginx_lxc@.service :
[Unit]
Description=Test of a specific nginx running in lxc
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
PIDFile=/run/nginx.%i.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.%i.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.%i.conf
Type=forking
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
[Install]
WantedBy=multi-user.target
Then create a container like this:
# virt-sandbox-service create -u nginx_lxc@
test.example.org --package nginx
And then we will have nginx running in a container, using the specific
config file /etc/nginx/nginx.test.example.org.conf
---
bin/virt-sandbox-service | 14 ++++++++++++++
bin/virt-sandbox-service-create.pod | 1 +
2 files changed, 15 insertions(+)