54 lines
1.5 KiB
Smarty
54 lines
1.5 KiB
Smarty
#cloud-config
|
|
#
|
|
# Example: install and configure vpn-router during first boot, supplying an
|
|
# existing CA and server certificate instead of letting the package generate
|
|
# one. See cloud-init.yaml.tpl for the variant that generates its own CA.
|
|
#
|
|
# Template variables are Terraform templatefile() placeholders. Adapt or drop
|
|
# them for whatever renders this file. <label> is the first component of the
|
|
# FQDN, for example "router" in router.example.com.
|
|
|
|
hostname: ${hostname}
|
|
fqdn: ${fqdn}
|
|
manage_etc_hosts: false
|
|
|
|
apt:
|
|
sources:
|
|
vpn-router:
|
|
source: "deb [signed-by=/etc/apt/keyrings/vpn-router.asc] ${repo_url} ${ubuntu_codename} main"
|
|
key: |
|
|
${indent(8, trimspace(repo_gpg_key))}
|
|
|
|
write_files:
|
|
# The configuration file. Created here before the package is installed, so
|
|
# postinst leaves it alone.
|
|
- path: /etc/vpn-router/vpn-router.json
|
|
permissions: '0600'
|
|
owner: root:root
|
|
content: |
|
|
${jsonencode(config)}
|
|
|
|
- path: /etc/vpn-router/pki/ca_cert.pem
|
|
permissions: '0644'
|
|
owner: root:root
|
|
content: |
|
|
${indent(6, trimspace(ca_cert))}
|
|
- path: /etc/vpn-router/pki/${label}_cert.pem
|
|
permissions: '0644'
|
|
owner: root:root
|
|
content: |
|
|
${indent(6, trimspace(server_cert))}
|
|
- path: /etc/vpn-router/pki/${label}_key.pem
|
|
permissions: '0600'
|
|
owner: root:root
|
|
content: |
|
|
${indent(6, trimspace(server_key))}
|
|
|
|
package_update: true
|
|
|
|
packages:
|
|
- vpn-router
|
|
|
|
# Nothing further is required: installing the package starts
|
|
# vpn-router-setup, which applies the configuration written above.
|