Skip to content
Ansible role to setup LXD, its bridge, pre-copy images and eventually pre-configure some
Shell Ruby
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
files sync repositories - galaxy meta fix, serverspec review, cleaning Oct 30, 2016
handlers galaxy lint Feb 8, 2019
meta galaxy lint Feb 8, 2019
tasks enable lxd-server config debug if verbosity 1 Jul 13, 2019
templates add default value for ansible_default_ipv4.address if undefined Jul 6, 2019
test test/default: remove lxd-bridge test - not on lxd3 Jun 30, 2019
vars redhat7: try copr-cli Jun 30, 2019
.gitignore add basic .gitignore May 11, 2019
.kitchen.vagrant.yml make separate test suite default-cluster Jun 29, 2019
.kitchen.yml kitchen: add missing centos-7 Jun 30, 2019
.travis.yml travis: disable centos7 Jun 30, 2019
.travis.yml.lxd travis config review Jun 29, 2019
.travis.yml.lxd-kitchen travis: downgrade test-kitchen to 1.25.0 - lxd_cli not supporting 2.x Jun 29, 2019
.travis.yml.simple travis/kitchen: fix ansible TRANSFORM_INVALID_GROUP_CHARS Jun 9, 2019
LICENSE Initial commit on github Aug 7, 2016 galaxy lint Feb 8, 2019

Build Status - Master Build Status - Devel

LXD ansible role

Ansible role to install LXD only and do network configuration.

Containers configuration or publishing is done in separated roles.

Requirements & Dependencies


It was tested on the following versions:

  • 2.0
  • 2.2
  • 2.5

Operating systems

Tested on Ubuntu 14.04, 16.04 and 18.04. Initial support for RHEL/Centos7 through ngompa/snapcore-el7 copr.

Example Playbook

Just include this role in your list. For example

- host: all
    - juju4.lxd


Nothing specific for now.

Continuous integration

This role has a travis test calling kitchen with lxd (for github), kitchen local with vagrant+virtualbox and also a Vagrantfile (test/vagrant).

Once you ensured all necessary roles are present, You can test with:

$ cd /path/to/roles/juju4.lxd
## lxd backend
$ kitchen verify
$ kitchen login
## vagrant+virtualbox backend
$ KITCHEN_YAML=".kitchen.vagrant.yml" kitchen verify


$ cd /path/to/roles/juju4.lxd/test/vagrant
$ vagrant up
$ vagrant ssh

Troubleshooting & Known issues

  • for network connectivity check if http_proxy is set (usually from /etc/default/lxd-bridge proxy settings) check iptables nat config for masquerading
# iptables -t nat -L
## if empty
# iptables -t nat -A POSTROUTING -s 10.x.y.0/24 -o eth0 -j MASQUERADE
  • if you want to forward traffic external to host to one of the private lxc container
# iptables -t nat -A PREROUTING -i if_incoming -p tcp --dport port_incoming -j DNAT --to-destination container_ip:container_port
  • role can be executed on centos/redhat system on containers as kernel is host's but RHEL/CentOS 7 has kernel 3.10 which is ?not compatible with LXC.
  • service command on centos7 stalling
$ /bin/systemctl start lxd


BSD 2-clause

You can’t perform that action at this time.