Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Latest commit

 

History

History
104 lines (69 loc) · 2.51 KB

README.md

File metadata and controls

104 lines (69 loc) · 2.51 KB

Lazy LXD

A tool for easy creating LXD containers.

Installing OpenSSH right from the script, for accessing into container thru SSH. And running Ansible playbooks over container.

Also have Russian language version of README

Requirements

  • Python >= 3.6
  • LXD
  • Ansible (Optionally). If you wish to run playbooks over created container.

Install

Just use the packet manager pip.

pip install lazy-lxd

Requirements

LXD

LXD need to be.

How to install:

apt:

$ apt install lxd lxd-client

snap:

$ snap install lxd

For centos use following article. Or use snap way.

For more information see official guide.

Ansible

If you want to run Ansible playbooks over container, you should have installed Ansible.

Python way:

$ pip install ansible

Usage

Help:

$ lazy-lxd --help

Simple container with default OS/version (Ubuntu/18.04):

$ lazy-lxd

Examples

Container with given name and OS/version is Centos 6:

$ lazy-lxd --name centos-container --os centos --release 6

Container with OS/version is Ubuntu 20.04 and with your path to Ansible playbooks:

$ lazy-lxd --os ubuntu --release 20.04 --playbooks-path $HOME/ansible/playbooks

Container with given name, default OS/version and exists SSH keys:

$ lazy-lxd --name ubuntu-focal --ssh-key-private $HOME/.ssh/id_rsa --ssh-key-public $HOME/.ssh/id_rsa.pub

Why script?

Why not to user utilities from CLI?

Needs to remember arguments of lxc, check that the container name is free, set OpenSSH into container every time, create keys manually, doing requests by container IP. All that this in one wrapper as script.

Run Ansible playbooks from script as bonus.

Why LXD?

In my opinion, LXD is better as container with OS for experiments, than Docker. It stateful, shouldn't think about data if container went down.

Docker is better choice for one service per container. But for OS experiments LXD is better.

License

This project uses the following license: MIT