Skip to content

Commit

Permalink
salt.cloud.lxc: lxc provider
Browse files Browse the repository at this point in the history
  • Loading branch information
kiorky committed Mar 6, 2014
1 parent 9f27fa0 commit 972efca
Show file tree
Hide file tree
Showing 6 changed files with 847 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/ref/clouds/all/index.rst
Expand Up @@ -18,6 +18,7 @@ Full list of Salt Cloud modules
gogrid
ibmsce
joyent
lxc
libcloud_aws
linode
msazure
Expand Down
6 changes: 6 additions & 0 deletions doc/ref/clouds/all/salt.cloud.clouds.lxc.rst
@@ -0,0 +1,6 @@
=====================
salt.cloud.clouds.lxc
=====================

.. automodule:: salt.cloud.clouds.lxc
:members:
33 changes: 33 additions & 0 deletions doc/topics/cloud/config.rst
Expand Up @@ -591,6 +591,39 @@ already set) in order to find the name of the location that you want to use.
``provider: my-imbsce-config`` instead of ``provider: ibmsce`` on a profile
configuration.

.. _config_lxc:

lxc
---

The lxc driver is a new, experimental driver for installing Salt on
newly provisionned (via saltcloud) lxc containers. It will in turn use saltify to install
salt an rattach the lxc container as a new lxc minion.
As soon as we can, we manage baremetal operation over SSH.
You can also destroy those containers via this driver.

.. code-block:: yaml
devhost10-lxc:
target: devhost10
provider: lxc
And in the map file:

.. code-block:: yaml
devhost10-lxc:
provider: devhost10-lxc
from_container: ubuntu
backing: lvm
sudo: True
size: 3g
ip: 10.0.3.9
minion:
master: 10.5.0.1
master_port: 4506
lxc_conf:
- lxc.utsname: superlxc
.. _config_saltify:

Expand Down
1 change: 1 addition & 0 deletions doc/topics/cloud/index.rst
Expand Up @@ -17,6 +17,7 @@ Getting Started
Getting Started With GoGrid <gogrid>
Getting Started With Google Compute Engine <gce>
Getting Started With Joyent <joyent>
Getting Started With LXC <lxc>
Getting Started With Linode <linode>
Getting Started With OpenStack <openstack>
Getting Started With Parallels <parallels>
Expand Down
124 changes: 124 additions & 0 deletions doc/topics/cloud/lxc.rst
@@ -0,0 +1,124 @@
===========================
Getting Started With LXC
===========================
The LXC module is designed to install a LXC container Salt via a salt master on a
controlled and possible remote minion.

In other words, we connect to a minion, then from that minion:
- we provision and configure a container for networking access
- We use saltify to deploy salt and rattach to master

Limitation
------------
- You can only act on one minion and one provider at a time.
- Listing images must be targeted to a particular driver (nothing will be outputted with 'all')

Operation
---------
This do not use lxc.init to provide a more generic fashion to tie minions
to their master (if any and defined) to allow custom association code.

Order of operation

- Spin up the lxc template container using salt.modules.lxc
on desired minion (clone or template)
- Change lxc config option if any to be changed
- Start container
- Change base passwords if any
- Change base DNS base configuration if neccessary
- Wait for lxc container to be up and ready for ssh
- Test ssh connection and bailout in error
- Via ssh (with the help of saltify, upload deploy script and seeds
and reattach minion.


Provider configuration
----------------------
Here are the options to configure your containers


Exemple:
.. code-block:: yaml
# Note: This example is for /etc/salt/cloud.providers or any file in the
# /etc/salt/cloud.providers.d/ directory.
devhost10-lxc:
target: devhost10
provider: lxc
Profile configuration
----------------------
Here are the options to configure your containers

target
Host minion id to install the lxc Container into
profile
lxc pillar profile
Container creation/clone options
Use a container using clone
from_container
Name of an original container using clone
snapshot
Do we use snapshots on cloned filesystems
lxc template using total creation
image
template to use
backing
Backing store type (None, lvm, brtfs)
lvname
LVM lvname if any
fstype
fstype
size
Size of the containera (for brtfs, or lvm)
vgname
LVM vgname if any
users
sysadmin users [ubuntu] of the container
ssh_username
sysadmin ssh_username (ubuntu) of the container
sudo
Do we use sudo
password
password for root and sysadmin (ubuntu)
mac
mac address to associate
ip
ip to link to
netmask
netmask for ip
bridge
bridge to use
dnsservers
optionnal list of dns servers to use
Will be restricted to that list if used
lxc_conf_unset
Configuration variables to unset in lxc conf
lxc_conf
LXC configuration variables to set in lxc_conf
minion
minion configuration (as usual with salt cloud)


.. code-block:: yaml
# Note: This example is for /etc/salt/cloud.profile or any file in the
# /etc/salt/cloud.profile.d/ directory.
devhost10-lxc:
provider: devhost10-lxc
from_container: ubuntu
backing: lvm
sudo: True
size: 3g
ip: 10.0.3.9
minion:
master: 10.5.0.1
master_port: 4506
lxc_conf:
- lxc.utsname: superlxc
The driver support
------------------
- Container creation
- Image listing (lxc templates)
- Running container informations (ips , etc)

0 comments on commit 972efca

Please sign in to comment.