-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add convenience script to set up LXC
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |