Skip to content

Instantly share code, notes, and snippets.

@schlueter
Last active November 11, 2022 22:51
Show Gist options
  • Save schlueter/ce1f2e32ef350bfa21e1b8b8605711b6 to your computer and use it in GitHub Desktop.
Save schlueter/ce1f2e32ef350bfa21e1b8b8605711b6 to your computer and use it in GitHub Desktop.
A Vagrant example of the systemd python package
# With Vagrant and Virtualbox installed, running `vagrant up` in a directory with this file
# will create an Ubuntu Xenial VM running on Virtualbox and then will install the
# prerequisites for and then the systemd python package for python3. After
# installation, a simple test is run and it's output will be shown.
$SCRIPT = <<EOS
apt-get update
apt-get install -qq libsystemd-dev libncurses5-dev python3-dev
curl -fsSl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
pip3 install systemd
python3 -c 'from systemd import journal; journal.write("Hello Lennart")'
journalctl -xe | tail
EOS
Vagrant.configure(2) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.provision :shell,
inline: $SCRIPT,
privileged: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment