2014-09-17 12:08:42 +00:00
|
|
|
ansible-lxc
|
|
|
|
===========
|
|
|
|
|
|
|
|
Ansible Connection Plugin for lxc containers (https://linuxcontainers.org/)
|
|
|
|
|
|
|
|
INSTALL
|
|
|
|
=======
|
|
|
|
|
2015-01-14 20:16:30 +00:00
|
|
|
* Install python2 version of lxc bindings:
|
|
|
|
|
|
|
|
- https://github.com/lxc/python2-lxc
|
|
|
|
|
|
|
|
* Clone the plugin in your ansible directory
|
2014-09-17 12:08:42 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
$ mkdir -p /etc/ansible/connection_plugins/
|
|
|
|
$ git clone git@github.com:Mic92/ansible-lxc.git /etc/ansible/connection_plugins/lxc
|
|
|
|
```
|
|
|
|
|
|
|
|
If your ansible code is already managed by git, you might want to add a submodule instead:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ mkdir -p /etc/ansible/connection_plugins/
|
|
|
|
$ git submodule add git@github.com:Mic92/ansible-lxc.git /etc/ansible/connection_plugins/lxc
|
|
|
|
```
|
|
|
|
|
2015-01-14 20:16:30 +00:00
|
|
|
* Then add lxc directory to plugin search path in `ansible.cfg`:
|
2014-09-17 12:08:42 +00:00
|
|
|
|
2015-01-14 20:16:30 +00:00
|
|
|
```
|
|
|
|
connection_plugins = /usr/share/ansible_plugins/connection_plugins:/etc/ansible/connection_plugins/lxc
|
|
|
|
```
|
2014-09-17 12:08:42 +00:00
|
|
|
|
|
|
|
USAGE
|
|
|
|
=====
|
|
|
|
|
|
|
|
In your hosts file use container name (`examplecontainer` in this case) as hostname and `ansible_connection` to lxc:
|
|
|
|
|
|
|
|
examplecontainer ansible_connection=lxc
|