Commit bfa13a30 authored by Pietro Albini's avatar Pietro Albini

lxd: installazione dell'hypervisor

parent 316d1b08
...@@ -22,3 +22,7 @@ ...@@ -22,3 +22,7 @@
- role: nginx - role: nginx
- role: lxd
subnet: 10.48.14
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
user: user:
name: "{{ item }}" name: "{{ item }}"
groups: allow-ssh,passwordless-sudo,systemd-journal groups: allow-ssh,passwordless-sudo,systemd-journal
append: true
state: present state: present
shell: /bin/bash shell: /bin/bash
......
---
- include_tasks: setup.yml
---
- name: Install required packages
apt:
name: "{{ item }}"
state: present
with_items:
- lxd
- dnsmasq
register: lxd_installed
- name: Add lxd-specific dnsmasq configuration
template:
src: dnsmasq.conf.j2
dest: /etc/dnsmasq.d/lxd
register: lxd_dnsmasq_changed
- name: Restart dnsmasq if needed
service:
name: dnsmasq
state: restarted
when: lxd_dnsmasq_changed.changed
- name: Upload the lxd-bridge configuration file
template:
src: lxd-bridge-default.j2
dest: /etc/default/lxd-bridge
- name: Initialize lxd
command: "lxd init --auto"
when: lxd_installed.changed
- name: Add all the admin users to the lxd group
user:
name: "{{ item }}"
groups: lxd
append: true
with_items: "{{ facts_common_admin_users }}"
server=/lxd/{{ subnet }}.1
bind-interfaces
except-interface=lxdbr0
# Whether to setup a new bridge or use an existing one
USE_LXD_BRIDGE="true"
# Bridge name
# This is still used even if USE_LXD_BRIDGE is set to false
# set to an empty value to fully disable
LXD_BRIDGE="lxdbr0"
# Update the "default" LXD profile
UPDATE_PROFILE="true"
# Path to an extra dnsmasq configuration file
LXD_CONFILE=""
# DNS domain for the bridge
LXD_DOMAIN="lxd"
# IPv4
## IPv4 address (e.g. 10.0.8.1)
LXD_IPV4_ADDR="{{ subnet }}.1"
## IPv4 netmask (e.g. 255.255.255.0)
LXD_IPV4_NETMASK="255.255.255.0"
## IPv4 network (e.g. 10.0.8.0/24)
LXD_IPV4_NETWORK="{{ subnet }}.0/24"
## IPv4 DHCP range (e.g. 10.0.8.2,10.0.8.254)
LXD_IPV4_DHCP_RANGE="{{ subnet }}.2,{{ subnet }}.254"
## IPv4 DHCP number of hosts (e.g. 250)
LXD_IPV4_DHCP_MAX="252"
## NAT IPv4 traffic
LXD_IPV4_NAT="true"
# IPv6
## IPv6 address (e.g. 2001:470:b368:4242::1)
LXD_IPV6_ADDR=""
## IPv6 CIDR mask (e.g. 64)
LXD_IPV6_MASK=""
## IPv6 network (e.g. 2001:470:b368:4242::/64)
LXD_IPV6_NETWORK=""
## NAT IPv6 traffic
LXD_IPV6_NAT="false"
# Run a minimal HTTP PROXY server
LXD_IPV6_PROXY="true"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment