Skip to main content

Easy creating LXD containers with included routine.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lazy-lxd-1.1.0.tar.gz (19.7 kB view hashes)

Uploaded Source

Built Distribution

lazy_lxd-1.1.0-py3-none-any.whl (26.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page