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
Just use the packet manager pip.
pip install lazy-lxd
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
Help:
$ lazy-lxd --help
Simple container with default OS/version (Ubuntu/18.04):
$ lazy-lxd
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 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.
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.
This project uses the following license: MIT