Skip to content

andreasscherbaum/ansible-lxd-container

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansible-lxd-container

Ansible role for creating LXD containers

Main usage

This is primarily my own set of instructions how to create a new container. But feel free to look around ...

Usage

The type of operating system (and the source of the image) is specified in defaults/main.yml, in lxc_container_os and lxc_container_source.

This can be overrided in your hosts.cfg, see the [http://docs.ansible.com/ansible/latest/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable](Ansible documentation).

The container name is defined in lxd_name, and must be unique on the host. The container host is defined in ansible_host.

This role will install https://www.openssh.com/ in the newly created container, create keys for root, add them to the known hosts lists on the container, and add the IPv4 address to /etc/hosts on the container host. In short: everything is ready that you can type in "ssh " on the host. Also Python version 2 is installed, in order to manage the container using Ansible.

Resources

A number of resources is set during container creation (not updated later on):

  • CPU allowance: lxd_cpu_allowance
  • CPU priority: lxd_cpu_priority
  • Memory limit: lxd_memory_limit
  • Swap: lxd_memory_swap
  • Memory limit enforcement: lxd_memory_enforcement

Defaults are in defaults/main.yml, and can be overridden.