Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add convenience script to set up LXC #902

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions bin/setup-lxc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh

# Set up Linux Containers (LXC)
#
# If you don't run Linux, you better look at Vagrant to set up virtual machines.
#
# But if you run Linux anyway then you can use LXC to run virtual machines on
# the same kernel instead of creating a full virtual machine.
#
# Installation in Debian:
#
# sudo apt install lxd
# sudo lxd init
# sudo usermod -aG lxd "$USER"
# # Restart your user's session to gain the new group privilege.
#
# You may also like to look at Lexi to manage your LXC containers:
#
# https://github.com/libre-ops/lexi

lxc launch ubuntu:20.04 ofn-dev
lxc exec ofn-dev -- sh -c 'cat >> .ssh/authorized_keys' < ~/.ssh/id_rsa.pub

# Enable browsing the OFN app via https://localhost:4433
lxc config device add ofn-dev myport4433 proxy listen=tcp:0.0.0.0:4433 connect=tcp:127.0.0.1:443

ip_address="$(lxc list | grep ofn-dev | cut -d' ' -f6)"
echo "
Host ofn.local
Hostname $ip_address
User root
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
LogLevel FATAL
" >> "$HOME/.ssh/config"

ansible-playbook -l lxc site.yml
Loading