From 9cffe7fe6c9ac0ba36e93f5912d5581d84b15b03 Mon Sep 17 00:00:00 2001 From: gshiva Date: Thu, 14 May 2020 13:55:05 -0700 Subject: [PATCH] added a sample that uses ubuntu core 64 bit version (#64) Also has sample install of zfs and node-exporter Co-authored-by: gshiva --- ...i-ubuntu-core-secure-zfs-nodeexporter.json | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 samples/pi-ubuntu-core-secure-zfs-nodeexporter.json diff --git a/samples/pi-ubuntu-core-secure-zfs-nodeexporter.json b/samples/pi-ubuntu-core-secure-zfs-nodeexporter.json new file mode 100644 index 00000000..8b6a6a4f --- /dev/null +++ b/samples/pi-ubuntu-core-secure-zfs-nodeexporter.json @@ -0,0 +1,58 @@ +{ + "variables": { + "home": "{{env `HOME`}}", + "node_exporter_version": "0.18.1" + }, + "builders": [{ + "type": "arm-image", + "image_type": "raspberrypi", + "qemu_binary": "qemu-aarch64-static", + "iso_url" : "http://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04-preinstalled-server-arm64+raspi.img.xz", + "iso_checksum_type":"sha256", + "iso_checksum":"48167067d65c5192ffe041c9cc4958cb7fcdfd74fa15e1937a47430ed7b9de99", + "last_partition_extra_size" : "1073741824", + "image_mounts": ["/boot/firmware","/"], + "chroot_mounts": [ + ["proc", "proc", "/proc"], + ["sysfs", "sysfs", "/sys"], + ["bind", "/dev", "/dev"], + ["devpts", "devpts", "/dev/pts"], + ["binfmt_misc", "binfmt_misc", "/proc/sys/fs/binfmt_misc"], + ["bind", "/run/resolvconf", "/run/resolvconf"] + ] + }], + "provisioners": [ + { + "type": "shell", + "inline": ["touch /boot/ssh"] + }, + { + "type": "file", + "source": "{{user `home`}}/.ssh/id_rsa.pub", + "destination": "/home/pi/.ssh/authorized_keys" + }, + { + "type": "shell", + "inline": [ + "sed '/PasswordAuthentication/d' -i /etc/ssh/ssh_config", + "echo >> /etc/ssh/ssh_config", + "echo 'PasswordAuthentication no' >> /etc/ssh/ssh_config" + ] + }, + { + "type": "shell", + "inline": [ + "apt-get update", + "apt-get install -y zfs-dkms, atop", + "curl -SL https://github.com/prometheus/node_exporter/releases/download/v{{user `node_exporter_version`}}/node_exporter-{{user `node_exporter_version`}}.linux-armv7.tar.gz > node_exporter.tar.gz", + "sudo tar -xvf node_exporter.tar.gz -C /usr/local/bin/ --strip-components=1", + "cd /etc/systemd/system/", + "curl -sSLo - https://raw.githubusercontent.com/prometheus/node_exporter/master/examples/systemd/node_exporter.service |sed -e 's|/etc/sysconfig/node_exporter|/etc/default/node_exporter|' |sed -e 's/^User.*//' > node_exporter.service", + "curl -sSLo - https://raw.githubusercontent.com/prometheus/node_exporter/master/examples/systemd/sysconfig.node_exporter |sed -e 's/^OPTIONS/#OPTIONS/;aOPTIONS=\"\"' >/etc/default/node_exporter", + "systemctl daemon-reload", + "systemctl enable node_exporter.service", + "systemctl start node_exporter.service" + ] + } + ] +}