diff --git a/templates/template16-zabbix-server/Readme.md b/templates/template16-zabbix-server/Readme.md index efb2417..58c8b3a 100644 --- a/templates/template16-zabbix-server/Readme.md +++ b/templates/template16-zabbix-server/Readme.md @@ -11,16 +11,16 @@ | `rootCA.pem` | The rootCA previously created in your host machine | | `rootCA-key.pem` | The rootCA key previously created in your host machine | | `zabbix.conf.php` | Zabbix PHP configuration file | -| `zabbix-release_X.Y-Z+ubuntu22.04_all.deb` | Apt repository installation package | +| `zabbix-release_X.Y-Z+ubuntu22.04_all.deb` | Apt repository installation package. Package picker available [here](https://www.zabbix.com/download?zabbix=6.4&os_distribution=ubuntu&os_version=22.04&components=server_frontend_agent&db=pgsql&ws=apache). Pick the Apache2/Postgres combination | | `zabbix_server.conf` | Main Zabbix configuration file | | `zabbix_virtualhost.conf` | Apache Virtualhost file for Zabbix Web Interface | * Create folder `log` -* Open `Vagrantfile` and change the value of variable `lxd.name`. It makes sense to give the same name as the folder, in this example `zabbix-server`. -* Open `provision.sh` - * change the value of variable `MACHINE_HOSTNAME`. It makes sense to give the same name as the folder, plus the domain, in this example `zabbix-server.localenv.com`. - * change the value of variable `ZABBIX_DEB_PACKAGE`. +* Open `Vagrantfile` and change the value of variable and parameters + * `lxd.name` (it is recommended to give the same name as the folder, in this example `zabbix-server`) + * `MACHINE_HOSTNAME` (it is recommended to give the same name as the folder, plus the domain, in this example `zabbix-server.localenv.com`) + * `ZABBIX_DEB_PACKAGE` * Run `vagrant up > log/provisioning.log` * Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` * Start using your environment diff --git a/templates/template16-zabbix-server/Vagrantfile b/templates/template16-zabbix-server/Vagrantfile index 77f1ec0..b3c0db3 100644 --- a/templates/template16-zabbix-server/Vagrantfile +++ b/templates/template16-zabbix-server/Vagrantfile @@ -4,14 +4,16 @@ Vagrant.configure("2") do |config| - config.vm.box = "isc/lxc-ubuntu-22.04" + config.vm.box = "isc/forge-clt-ubuntu-22.04" + + config.vm.box_version = "1" config.vm.box_check_update = false - + config.vm.provider 'lxd' do |lxd| lxd.api_endpoint = 'https://127.0.0.1:8443' lxd.timeout = 10 - lxd.name = 'your-container-name' + lxd.name = '' lxd.project = 'default' lxd.profiles = ['default'] # lxd.nesting = nil @@ -21,6 +23,11 @@ # lxd.config = {} end - config.vm.provision :shell, path: "provision.sh" - + config.vm.provision "shell" do |s| + s.env = { + "MACHINE_HOSTNAME" => "", + "ZABBIX_DEB_PACKAGE" => "" + } + s.path = "provision.sh" + end end diff --git a/templates/template16-zabbix-server/artifacts/zabbix_virtualhost.conf b/templates/template16-zabbix-server/artifacts/zabbix_virtualhost.conf index a3d5c0d..43e2470 100644 --- a/templates/template16-zabbix-server/artifacts/zabbix_virtualhost.conf +++ b/templates/template16-zabbix-server/artifacts/zabbix_virtualhost.conf @@ -30,5 +30,7 @@ + RedirectMatch ^/$ /zabbix/ + diff --git a/templates/template16-zabbix-server/provision.sh b/templates/template16-zabbix-server/provision.sh index 1ee35ed..8f1a526 100644 --- a/templates/template16-zabbix-server/provision.sh +++ b/templates/template16-zabbix-server/provision.sh @@ -6,16 +6,6 @@ echo "provisioning started: ${start_time}" -#### The user must fill these variables - START - -MACHINE_HOSTNAME= - -ZABBIX_DEB_PACKAGE= - -#### The user must fill these variables - END - -SYSTEM_USER=usrv - NETWORK_INTERFACE=eth0 hostnamectl set-hostname ${MACHINE_HOSTNAME} @@ -99,11 +89,9 @@ echo "This container has IP (interface: ${NETWORK_INTERFACE}): ${ip_address}" -echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file:" +echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file or configure LXD nameserver," -echo " You can start configuring and using your Zabbix instance by connecting to the web panel https://${MACHINE_HOSTNAME} with user Admin and password zabbix" - -echo " You can connect with user ${SYSTEM_USER} via ssh (password ${SYSTEM_USER}): ssh ${SYSTEM_USER}@${MACHINE_HOSTNAME}" +echo "you can start configuring and using your Zabbix instance by connecting to the web panel https://${MACHINE_HOSTNAME} with user Admin and password zabbix" echo "provisioning started: ${start_time}"