---

- apt:
    name: "{{ item }}"
    update_cache: true
  with_items:
    - btrfs-tools
    - lxd
  tags:
    - lxd

- name: enable lxd
  service:
    name: lxd
    state: started
  tags:
    - lxd

- name: format ssd for lxd mount volume
  filesystem:
    fstype: btrfs
    opts: '--metadata single --data single'
    dev: "{{ lxd.device }}"
  tags:
    - lxd

- name: mount on /var/lib/lxd
  mount:
    name: /var/lib/lxd
    src: "{{ lxd.device }}"
    fstype: btrfs
    opts: noatime
    state: present
  tags:
    - lxd

---

- apt:
    name: "{{ item }}"
    update_cache: true
  with_items:
    - btrfs-tools
    - lxd
  tags:
    - lxd

- name: enable lxd
  service:
    name: lxd
    state: started
  tags:
    - lxd

- name: format ssd for lxd mount volume
  filesystem:
    fstype: btrfs
    opts: '--metadata single --data single'
    dev: "{{ lxd.device }}"
  tags:
    - lxd

- name: mount on /var/lib/lxd
  mount:
    name: /var/lib/lxd
    src: "{{ lxd.device }}"
    fstype: btrfs
    opts: noatime
    state: present
  tags:
    - lxd

- name: set sysctl values
  sysctl:
    name: "{{ item }}"
    value: 1048576
    sysctl_set: yes
  with_items:
    - 'fs.inotify.max_queued_events'
    - 'fs.inotify.max_user_instances'
    - 'fs.inotify.max_user_watches'
  tags:
    - lxd

Implement sane limits for LXD
[Config-Management] Implement sane limits for LXD

New documentation has been produced since we started using LXD which
contains new best-practices.

The documentation at
https://github.com/lxc/lxd/blob/master/doc/production-setup.md indicates
that some fs.inotify sysctl flags shoudl be set to very large values to
give the containers started under LXD room to breathe.

This is a parital fix for #34.
