diff --git a/files/ubuntu/librenms.conf b/files/ubuntu/librenms.conf index 48b5f2b..0f289e9 100644 --- a/files/ubuntu/librenms.conf +++ b/files/ubuntu/librenms.conf @@ -10,15 +10,12 @@ server { location / { try_files $uri $uri/ /index.php?$query_string; } - location /api/v0 { - try_files $uri $uri/ /api_v0.php?$query_string; - } - location ~ \.php { - include fastcgi.conf; + location ~ [^/]\.php(/|$) { + fastcgi_pass unix:/run/php-fpm-librenms.sock; fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; + include fastcgi.conf; } - location ~ /\.ht { + location ~ /\.(?!well-known).* { deny all; } } diff --git a/http/ubuntu-20.04/meta-data b/http/ubuntu-20.04/meta-data new file mode 100644 index 0000000..e69de29 diff --git a/http/ubuntu-18.04/preseed.cfg b/http/ubuntu-20.04/preseed.cfg similarity index 100% rename from http/ubuntu-18.04/preseed.cfg rename to http/ubuntu-20.04/preseed.cfg diff --git a/http/ubuntu-20.04/user-data b/http/ubuntu-20.04/user-data new file mode 100644 index 0000000..44d4759 --- /dev/null +++ b/http/ubuntu-20.04/user-data @@ -0,0 +1,14 @@ +#cloud-config +autoinstall: + version: 1 + identity: + hostname: librenms + password: $6$p7TmlCd1WIljlXVE$B8Yr1f6eVvQrlE5qsk3dp6heo1YveUdXBzXwYY5bhMlbcyl9rvZtH0AkW1ntiE2jgYA8GEQ4vx/lsjxYNwHuK. + username: vagrant + storage: + layout: + name: lvm + update: true + ssh: + install-server: true + allow-pw: true diff --git a/scripts/ubuntu/apt.sh b/scripts/ubuntu/apt.sh deleted file mode 100644 index a5c341a..0000000 --- a/scripts/ubuntu/apt.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -set -e -set -x - -sudo apt-get update diff --git a/scripts/ubuntu/cleanup.sh b/scripts/ubuntu/cleanup.sh index c1c5977..8580dab 100644 --- a/scripts/ubuntu/cleanup.sh +++ b/scripts/ubuntu/cleanup.sh @@ -6,20 +6,6 @@ SSH_USER=${SSH_USERNAME:-vagrant} echo "==> Cleaning up udev rules" rm -rf /dev/.udev/ rm -f /lib/udev/rules.d/75-persistent-net-generator.rules - -echo "==> Cleaning up leftover dhcp leases" -# Ubuntu 10.04 -if [ -d "/var/lib/dhcp3" ]; then - rm /var/lib/dhcp3/* -fi -# Ubuntu 12.04 & 14.04 -if [ -d "/var/lib/dhcp" ]; then - rm /var/lib/dhcp/* -fi - -# Add delay to prevent "vagrant reload" from failing -echo "pre-up sleep 2" >> /etc/network/interfaces - echo "==> Cleaning up tmp" rm -rf /tmp/* diff --git a/scripts/ubuntu/librenms.sh b/scripts/ubuntu/librenms.sh index e75aab0..b39cf79 100644 --- a/scripts/ubuntu/librenms.sh +++ b/scripts/ubuntu/librenms.sh @@ -4,79 +4,77 @@ if [[ -z "$LIBRENMS_VERSION" ]]; then LIBRENMS_VERSION="master" fi -sudo add-apt-repository universe -sudo apt update -y -sudo apt install -y curl composer fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nginx-full nmap php7.2-cli php7.2-curl php7.2-fpm php7.2-gd php7.2-json php7.2-mbstring php7.2-mysql php7.2-snmp php7.2-xml php7.2-zip python-memcache python-mysqldb rrdtool snmp snmpd whois acl python-mysqldb - -sudo sh -c "cd /opt; composer create-project --no-dev --keep-vcs librenms/librenms=$LIBRENMS_VERSION librenms" +apt -y install software-properties-common +add-apt-repository universe +apt -y update +apt -y install acl curl composer fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nginx-full nmap php7.4-cli php7.4-curl php7.4-fpm php7.4-gd php7.4-json php7.4-mbstring php7.4-mysql php7.4-snmp php7.4-xml php7.4-zip rrdtool snmp snmpd whois unzip python3-pymysql python3-dotenv python3-redis python3-setuptools sudo useradd librenms -d /opt/librenms -M -s /bin/bash echo "librenms:CDne3fwdfds" | sudo chpasswd sudo usermod -a -G librenms www-data -sudo cp -r /etc/skel/. /opt/librenms - sudo bash -c 'cat < /etc/sudoers.d/librenms Defaults:librenms !requiretty librenms ALL=(ALL) NOPASSWD: ALL EOF' - sudo chmod 440 /etc/sudoers.d/librenms -# Change php to UTC TZ -sudo sed -i "s/;date.timezone =.*/date.timezone = UTC/" /etc/php/7.2/fpm/php.ini -sudo sed -i "s/;date.timezone =.*/date.timezone = UTC/" /etc/php/7.2/cli/php.ini +cd /opt +git clone https://github.com/librenms/librenms.git +chown -R librenms:librenms /opt/librenms +chmod 771 /opt/librenms +setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/ +setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/ +cd /opt/librenms +sudo -u librenms ./scripts/composer_wrapper.php install --no-dev -sudo systemctl enable php7.2-fpm -sudo systemctl restart php7.2-fpm +# Change php to UTC TZ +sudo sed -i "s/;date.timezone =.*/date.timezone = UTC/" /etc/php/7.4/fpm/php.ini +sudo sed -i "s/;date.timezone =.*/date.timezone = UTC/" /etc/php/7.4/cli/php.ini +mv /etc/php/7.4/fpm/pool.d/www.conf /etc/php/7.4/fpm/pool.d/librenms.conf +sed -i "s/user = .*/user = librenms/" /etc/php/7.4/fpm/pool.d/librenms.conf +sed -i "s/group = .*/group = librenms/" /etc/php/7.4/fpm/pool.d/librenms.conf +sed -i "s|listen = .*|listen = /run/php-fpm-librenms.sock|" /etc/php/7.4/fpm/pool.d/librenms.conf +systemctl restart php7.4-fpm.service +systemctl enable php7.4-fpm.service + +ln -s /opt/librenms/lnms /usr/bin/lnms +cp /opt/librenms/misc/lnms-completion.bash /etc/bash_completion.d/ sudo cp /tmp/librenms.conf /etc/nginx/conf.d/librenms.conf - sudo rm -f /etc/nginx/sites-enabled/default - sudo systemctl enable nginx sudo systemctl restart nginx sudo cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms -sudo firewall-cmd --zone public --add-service http -sudo firewall-cmd --permanent --zone public --add-service http -sudo firewall-cmd --zone public --add-service https -sudo firewall-cmd --permanent --zone public --add-service https - sudo apt install -y rrdcached sudo mkdir /var/run/rrdcached sudo chown librenms:librenms /var/run/rrdcached sudo chmod 755 /var/run/rrdcached -sudo bash -c 'cat << EOF > /etc/systemd/system/rrdcached.service -[Unit] -Description=Data caching daemon for rrdtool -After=network.service - -[Service] -Type=forking -PIDFile=/run/rrdcached.pid -ExecStart=/usr/bin/rrdcached -w 1800 -z 1800 -f 3600 -s librenms -U librenms -G librenms -B -R -j /var/tmp -l unix:/var/run/rrdcached/rrdcached.sock -t 4 -F -b /opt/librenms/rrd/ - -[Install] -WantedBy=default.target +bash -c 'cat << EOF > /etc/default/rrdcached +DAEMON=/usr/bin/rrdcached +DAEMON_USER=librenms +DAEMON_GROUP=librenms +WRITE_THREADS=4 +WRITE_TIMEOUT=1800 +WRITE_JITTER=1800 +BASE_PATH=/opt/librenms/rrd/ +JOURNAL_PATH=/var/lib/rrdcached/journal/ +PIDFILE=/run/rrdcached.pid +SOCKFILE=/run/rrdcached.sock +SOCKGROUP=librenms +BASE_OPTIONS="-B -F -R" EOF' +chown librenms:librenms /var/lib/rrdcached/journal/ +systemctl restart rrdcached.service -sudo systemctl daemon-reload -sudo systemctl enable --now rrdcached.service -sudo bash -c 'cat << EOF > /etc/mysql/mariadb.conf.d/50-server.cnf -# -# These groups are read by MariaDB server. -# Use it for options that only the server (but not clients) should see -# -# See the examples of server my.cnf files in /usr/share/mysql/ -# - -# this is read by the standalone daemon and embedded servers +sudo bash -c 'cat << EOF > /etc/mysql/mariadb.conf.d/99-librenms.cnf [server] innodb_file_per_table=1 lower_case_table_names=0 +innodb_flush_log_at_trx_commit = 2 EOF' sudo systemctl enable mysql @@ -84,18 +82,31 @@ sudo systemctl restart mysql mysql_pass="D42nf23rewD"; -echo "CREATE DATABASE librenms; +echo "CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci; GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost' IDENTIFIED BY '$mysql_pass'; FLUSH PRIVILEGES;" | mysql -u root sudo cp /opt/librenms/config.php.default /opt/librenms/config.php +echo \$config[\'db_host\'] = \'localhost\'\; | tee -a /opt/librenms/config.php +echo \$config[\'db_user\'] = \'librenms\'\; | tee -a /opt/librenms/config.php +echo \$config[\'db_pass\'] = \'$mysql_pass\'\; | tee -a /opt/librenms/config.php +echo \$config[\'db_name\'] = \'librenms\'\; | tee -a /opt/librenms/config.php +echo \$config[\'rrdcached\'] = \'unix:/var/run/rrdcached.sock\'\; | tee -a /opt/librenms/config.php + +echo "DB_HOST=localhost" | tee -a /opt/librenms/.env +echo "DB_DATABASE=librenms" | tee -a /opt/librenms/.env +echo "DB_USER=localhost" | tee -a /opt/librenms/.env +echo "DB_PASSWORD=$mysql_pass" | tee -a /opt/librenms/.env +echo "LIBRENMS_USER=librenms" | tee -a /opt/librenms/.env +echo "APP_URL=/" | tee -a /opt/librenms/.env +sed -i '/INSTALL=true/d' /opt/librenms/.env + +# This does all the heavy lifting for the DB! +sudo -u librenms /usr/bin/lnms --force -n migrate -sudo sed -i 's/USERNAME/librenms/g' /opt/librenms/config.php -sudo sed -i "s/PASSWORD/${mysql_pass}/g" /opt/librenms/config.php -sudo bash -c "echo '\$config[\"rrdcached\"] = \"unix:/var/run/rrdcached/rrdcached.sock\";' >> /opt/librenms/config.php" -sudo bash -c "echo '\$config[\"update_channel\"] = \"release\";' >> /opt/librenms/config.php" +sudo -u librenms /usr/bin/lsnm -n config:set update_channel release sudo bash -c 'cat < /etc/snmp/snmpd.conf rocommunity public 127.0.0.1 @@ -108,20 +119,20 @@ sudo chmod +x /usr/bin/distro sudo systemctl restart snmpd sudo systemctl enable snmpd -sudo cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms -sudo sed -i "s/16/4/g" /etc/cron.d/librenms +sudo -u librenms python3 -m pip install --user -r /opt/librenms/requirements.txt +cp /opt/librenms/misc/librenms.service /etc/systemd/system/librenms.service +systemctl enable librenms.service -sudo /usr/bin/php /opt/librenms/build-base.php -sudo /usr/bin/php /opt/librenms/addhost.php localhost public v2c -sudo /usr/bin/php /opt/librenms/adduser.php librenms D32fwefwef 10 +sudo -u librenms /usr/bin/lnms -n user:add -p D32fwefwef -r admin -n librenms +sudo -u librenms /usr/bin/lnms -n --v2c device:add localhost sudo git clone https://github.com/librenms-plugins/Weathermap.git /opt/librenms/html/plugins/Weathermap/ echo "INSERT INTO plugins SET plugin_name = 'Weathermap', plugin_active = 1;" | mysql -u root librenms sudo bash -c "echo '*/5 * * * * librenms /opt/librenms/html/plugins/Weathermap/map-poller.php >> /dev/null 2>&1' >> /etc/cron.d/librenms" -sudo chmod -R g+w /opt/librenms/html/plugins/Weathermap/configs/ +chown -R librenms:librenms /opt/librenms/html/plugins/Weathermap/ +chmod -R 775 /opt/librenms/html/plugins/Weathermap/configs/ sudo chown -R librenms:librenms /opt/librenms sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/ sudo chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/ -sudo su - librenms -c "git checkout ." diff --git a/scripts/ubuntu/oxidized.sh b/scripts/ubuntu/oxidized.sh index d3fc7ad..d3a0306 100644 --- a/scripts/ubuntu/oxidized.sh +++ b/scripts/ubuntu/oxidized.sh @@ -4,7 +4,8 @@ if [[ "$OXIDIZED" == false ]]; then echo "Oxidized support disabled" exit 0 fi - +#TODO +exit 0 sudo add-apt-repository universe sudo apt install -y ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev libicu-dev zlib1g-dev sudo gem install oxidized diff --git a/scripts/ubuntu/syslog-ng.sh b/scripts/ubuntu/syslog-ng.sh index 5626a1e..5e9ab76 100644 --- a/scripts/ubuntu/syslog-ng.sh +++ b/scripts/ubuntu/syslog-ng.sh @@ -63,4 +63,4 @@ EOF' sudo systemctl enable syslog-ng sudo systemctl restart syslog-ng -sudo bash -c "echo '\$config[\"enable_syslog\"] = 1;' >> /opt/librenms/config.php" +echo \$config[\'enable_syslog\'] = 1\; | tee -a /opt/librenms/config.php diff --git a/scripts/ubuntu/update.sh b/scripts/ubuntu/update.sh index d0d12f1..1d26674 100644 --- a/scripts/ubuntu/update.sh +++ b/scripts/ubuntu/update.sh @@ -2,7 +2,6 @@ # locale echo "==> Configuring locales" -apt-get -y purge language-pack-en language-pack-gnome-en sed -i -e '/^[^# ]/s/^/# /' /etc/locale.gen LANG=en_US.UTF-8 LC_ALL=$LANG @@ -16,27 +15,23 @@ sed -i.bak 's/^Prompt=.*$/Prompt=never/' /etc/update-manager/release-upgrades echo "==> Disabling apt.daily.service" systemctl stop apt-daily.timer systemctl disable apt-daily.timer -systemctl mask apt-daily.service systemctl daemon-reload # install packages and upgrade echo "==> Updating list of repositories" -apt-get -y update +apt -y update if [[ $UPDATE =~ true || $UPDATE =~ 1 || $UPDATE =~ yes ]]; then - apt-get -y dist-upgrade - apt-get -y autoremove --purge + apt -y dist-upgrade + apt -y autoremove --purge fi -apt-get -y install build-essential linux-headers-generic -apt-get -y install ssh nfs-common vim curl perl git -apt-get -y autoclean -apt-get -y clean +apt -y install build-essential linux-headers-generic +apt -y install ssh nfs-common vim curl perl git +apt -y autoclean +apt -y clean # Remove 5s grub timeout to speed up booting sed -i -e 's/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT=0/' \ -e 's/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="quiet nosplash"/' \ /etc/default/grub update-grub -# SSH tweaks -echo "UseDNS no" >> /etc/ssh/sshd_config - exit 0 diff --git a/ubuntu-18.04-amd64.json b/ubuntu-18.04-amd64.json deleted file mode 100644 index 217b419..0000000 --- a/ubuntu-18.04-amd64.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "_comment": "Build with `packer build ubuntu.json`", - "builders": [{ - "type": "virtualbox-iso", - "boot_command": [ - "{{ user `boot_command_prefix` }}", - "/install/vmlinuz noapic ", - "initrd=/install/initrd.gz ", - "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu-18.04/preseed.cfg ", - "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", - "hostname={{ user `hostname` }} ", - "grub-installer/bootdev=/dev/sda ", - "fb=false debconf/frontend=noninteractive ", - "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", - "keyboard-configuration/variant=USA console-setup/ask_detect=false ", - "passwd/user-fullname={{ user `ssh_fullname` }} ", - "passwd/user-password={{ user `ssh_password` }} ", - "passwd/user-password-again={{ user `ssh_password` }} ", - "passwd/username={{ user `ssh_username` }} ", - "-- " - ], - "disk_size": "{{ user `disk_size` }}", - "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", - "guest_os_type": "Ubuntu_64", - "headless": "{{ user `headless` }}", - "http_directory": "http", - "iso_checksum": "{{ user `iso_checksum` }}", - "iso_checksum_type": "{{ user `iso_checksum_type` }}", - "iso_urls": [ - "{{ user `iso_path` }}/{{ user `iso_name` }}", - "{{ user `mirror` }}/ubuntu/releases/bionic/release/{{ user `iso_name` }}" - ], - "shutdown_command": "sudo usermod -L vagrant && sudo chage -d 0 vagrant && sudo systemctl poweroff", - "ssh_password": "{{ user `ssh_password` }}", - "ssh_username": "{{ user `ssh_username` }}", - "ssh_timeout": "{{user `ssh_timeout`}}", - "vboxmanage": [ - ["modifyvm", "{{.Name}}", "--audio", "none"], - ["modifyvm", "{{.Name}}", "--usb", "off"], - ["modifyvm", "{{.Name}}", "--vram", "12"], - ["modifyvm", "{{.Name}}", "--vrde", "off"], - ["modifyvm", "{{.Name}}", "--memory", "{{ user `memory` }}"], - ["modifyvm", "{{.Name}}", "--cpus", "{{ user `cpus` }}"], - [ "modifyvm", "{{.Name}}", "--natpf1", "ssh,tcp,,2023,,22" ], - [ "modifyvm", "{{.Name}}", "--natpf1", "http,tcp,,8080,,80" ] - ], - "virtualbox_version_file": ".vbox_version", - "output_directory": "output-ubuntu-18.04-amd64-{{build_type}}", - "vm_name": "librenms-ubuntu-18.04-amd64", - "export_opts": - [ - "--manifest", - "--vsys", "0", - "--product", "LibreNMS", - "--producturl", "https://www.librenms.org", - "--description", "LibreNMS, a fully featured network monitoring system that provides a wealth of features and device support.", - "--version", "LibreNMS" - ], - "format": "ova" - }], - "provisioners": [ - { - "type": "file", - "source": "files/ubuntu/librenms.conf", - "destination": "/tmp/librenms.conf" - }, - { - "environment_vars": [ - "DEBIAN_FRONTEND=noninteractive", - "DESKTOP={{user `desktop`}}", - "UPDATE={{user `update`}}", - "INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}", - "SSH_USERNAME={{user `ssh_username`}}", - "SSH_PASSWORD={{user `ssh_password`}}", - "http_proxy={{user `http_proxy`}}", - "https_proxy={{user `https_proxy`}}", - "no_proxy={{user `no_proxy`}}", - "LIBRENMS_VERSION={{user `librenms_version`}}", - "OXIDIZED={{user `oxidized`}}", - "SYSLOG_NG={{user `syslog_ng`}}" - ], - "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'", - "expect_disconnect": true, - "type": "shell", - "scripts": [ - "scripts/ubuntu/update.sh", - "scripts/ubuntu/apt.sh", - "scripts/ubuntu/virtualbox.sh", - "scripts/ubuntu/vmware.sh", - "scripts/common/vagrant.sh", - "scripts/common/sshd.sh", - "scripts/ubuntu/librenms.sh", - "scripts/ubuntu/syslog-ng.sh", - "scripts/ubuntu/oxidized.sh", - "scripts/ubuntu/cleanup.sh", - "scripts/common/finish.sh", - "scripts/ubuntu/minimize.sh", - "scripts/common/clean_users.sh" - ] - }], - "variables": { - "boot_command_prefix": "", - "cpus": "1", - "desktop": "false", - "disk_size": "40960", - "headless": "false", - "http_proxy": "{{env `http_proxy`}}", - "https_proxy": "{{env `https_proxy`}}", - "install_vagrant_key": "true", - "iso_checksum": "a2cb36dc010d98ad9253ea5ad5a07fd6b409e3412c48f1860536970b073c98f5", - "iso_checksum_type": "sha256", - "iso_name": "ubuntu-18.04.2-server-amd64.iso", - "iso_path": "iso", - "mirror": "http://cdimage.ubuntu.com", - "memory": "512", - "no_proxy": "{{env `no_proxy`}}", - "hostname": "librenms", - "ssh_fullname": "vagrant", - "ssh_password": "vagrant", - "ssh_username": "vagrant", - "ssh_timeout": "60m", - "update": "true" - } -} diff --git a/ubuntu-20.04-amd64.json b/ubuntu-20.04-amd64.json new file mode 100644 index 0000000..9301a43 --- /dev/null +++ b/ubuntu-20.04-amd64.json @@ -0,0 +1,166 @@ +{ + "_comment": "Build with `packer build ubuntu.json`", + "builders": [ + { + "boot_command": [ + "{{ user `boot_command_prefix` }}", + "/casper/vmlinuz ", + "root=/dev/sr0 ", + "initrd=/casper/initrd ", + "acpi=off noapic ", + "autoinstall ", + "ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu-20.04/", + "" + ], + "boot_wait": "5s", + "boot_keygroup_interval": "300ms", + "disk_size": "{{ user `disk_size` }}", + "export_opts": [ + "--manifest", + "--vsys", + "0", + "--product", + "LibreNMS", + "--producturl", + "https://www.librenms.org", + "--description", + "LibreNMS, a fully featured network monitoring system that provides a wealth of features and device support.", + "--version", + "LibreNMS" + ], + "format": "ova", + "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", + "guest_os_type": "Ubuntu_64", + "headless": "{{ user `headless` }}", + "http_directory": "http", + "iso_checksum": "{{ user `iso_checksum_type` }}:{{ user `iso_checksum` }}", + "iso_urls": [ + "{{ user `iso_path` }}/{{ user `iso_name` }}", + "{{ user `mirror` }}/focal/{{ user `iso_name` }}" + ], + "output_directory": "output-ubuntu-20.04-amd64-{{build_type}}", + "shutdown_command": "sudo usermod -L vagrant \u0026\u0026 sudo chage -d 0 vagrant \u0026\u0026 sudo systemctl poweroff", + "ssh_handshake_attempts":"1000", + "ssh_password": "{{ user `ssh_password` }}", + "ssh_timeout": "{{user `ssh_timeout`}}", + "ssh_username": "{{ user `ssh_username` }}", + "type": "virtualbox-iso", + "vboxmanage": [ + [ + "modifyvm", + "{{.Name}}", + "--audio", + "none" + ], + [ + "modifyvm", + "{{.Name}}", + "--usb", + "off" + ], + [ + "modifyvm", + "{{.Name}}", + "--vram", + "12" + ], + [ + "modifyvm", + "{{.Name}}", + "--vrde", + "off" + ], + [ + "modifyvm", + "{{.Name}}", + "--memory", + "{{ user `memory` }}" + ], + [ + "modifyvm", + "{{.Name}}", + "--cpus", + "{{ user `cpus` }}" + ], + [ + "modifyvm", + "{{.Name}}", + "--natpf1", + "ssh,tcp,,2023,,22" + ], + [ + "modifyvm", + "{{.Name}}", + "--natpf1", + "http,tcp,,8080,,80" + ] + ], + "virtualbox_version_file": ".vbox_version", + "vm_name": "librenms-ubuntu-20.04-amd64" + } + ], + "provisioners": [ + { + "destination": "/tmp/librenms.conf", + "source": "files/ubuntu/librenms.conf", + "type": "file" + }, + { + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive", + "DESKTOP={{user `desktop`}}", + "UPDATE={{user `update`}}", + "INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}", + "SSH_USERNAME={{user `ssh_username`}}", + "SSH_PASSWORD={{user `ssh_password`}}", + "http_proxy={{user `http_proxy`}}", + "https_proxy={{user `https_proxy`}}", + "no_proxy={{user `no_proxy`}}", + "LIBRENMS_VERSION={{user `librenms_version`}}", + "OXIDIZED={{user `oxidized`}}", + "SYSLOG_NG={{user `syslog_ng`}}" + ], + "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'", + "expect_disconnect": true, + "scripts": [ + "scripts/ubuntu/update.sh", + "scripts/ubuntu/virtualbox.sh", + "scripts/ubuntu/vmware.sh", + "scripts/common/vagrant.sh", + "scripts/common/sshd.sh", + "scripts/ubuntu/librenms.sh", + "scripts/ubuntu/syslog-ng.sh", + "scripts/ubuntu/oxidized.sh", + "scripts/ubuntu/cleanup.sh", + "scripts/common/finish.sh", + "scripts/ubuntu/minimize.sh", + "scripts/common/clean_users.sh" + ], + "type": "shell" + } + ], + "variables": { + "boot_command_prefix": "", + "cpus": "1", + "desktop": "false", + "disk_size": "40960", + "headless": "false", + "hostname": "librenms", + "http_proxy": "{{env `http_proxy`}}", + "https_proxy": "{{env `https_proxy`}}", + "install_vagrant_key": "true", + "iso_checksum": "d1f2bf834bbe9bb43faf16f9be992a6f3935e65be0edece1dee2aa6eb1767423", + "iso_checksum_type": "sha256", + "iso_name": "ubuntu-20.04.2-live-server-amd64.iso", + "iso_path": "iso", + "memory": "1024", + "mirror": "http://releases.ubuntu.com", + "no_proxy": "{{env `no_proxy`}}", + "ssh_fullname": "vagrant", + "ssh_password": "vagrant", + "ssh_timeout": "60m", + "ssh_username": "vagrant", + "update": "true" + } +} +