Compare commits

..

No commits in common. "1d0e5df1558df5af2617668232e3e317cd62a1b3" and "707b014ae9d582ceaeb638610beb94842069ed71" have entirely different histories.

8 changed files with 1954 additions and 36 deletions

View file

@ -16,9 +16,10 @@
- "zfsutils-linux"
- ansible.builtin.include_role:
name: init_lxd
name: init_lxd
#vars:
# - lxd_init_template_config_path="/path/to/my/custom/template"
# - lxd_init_template_config_path="/path/to/my/template"
## Rollback
- hosts: ubuntu_lxd
@ -27,11 +28,4 @@
tasks:
- shell: "snap remove --purge lxd"
become: true
- name: Install packages
ansible.builtin.package:
name: "{{item}}"
state: absent
with_items:
- "ansible"
- "zfsutils-linux"

View file

@ -0,0 +1,29 @@
---
language: python
python: "2.7"
# Use the new container infrastructure
sudo: false
# Install ansible
addons:
apt:
packages:
- python-pip
install:
# Install ansible
- pip install ansible
# Check ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View file

@ -1,14 +1,4 @@
---
# defaults file for roles/init_lxd
lxd_init_template_config_path: "templates/default_config.yml.j2"
lxd_init_template_processed_path: "/tmp/default_config.yml"
## LXD Default
lxd_project_name: "default"
# - Storage
storage_pool_name: "default"
storage_pool_driver: "zfs"
storage_pool_size: "20GB"
# - Network
network_default_name: "lxdbr0"
lxd_init_template_processed_path: "/tmp/default_config.yml"

View file

@ -7,7 +7,7 @@
classic: yes
- ansible.builtin.debug:
var: hostvars[inventory_hostname]['ansible_default_ipv6']['address']
var:
verbosity: 1
- delegate_to: localhost
@ -33,3 +33,4 @@
- ansible.builtin.debug:
var: lxd_init_output
verbosity: 2

View file

@ -4,36 +4,39 @@ config:
# --
networks:
- name: {{network_default_name}}
project: {{lxd_project_name}}
type: bridge
config:
# IPv4
- config:
# IPv4
ipv4.nat: "true"
ipv4.address: {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}
# IPv6
# IPv6
ipv6.nat: "true"
ipv6.address: {{ hostvars[inventory_hostname]['ansible_default_ipv6']['address'] }}
name: lxdbr0
type: bridge
project: default
# --
storage_pools:
- name: {{storage_pool}}
driver: {{storage_pool_driver}}
config:
size: {{storage_pool_size}}
- config:
size: 20GB
source: /var/snap/lxd/common/lxd/disks/default.img
name: default
driver: zfs
# --
profiles:
- name: {{lxd_project_name}}
- config: {}
description: Default LXD profile
devices:
eth0:
name: eth0
network: {{network_default_name}}
network: lxdbr0
type: nic
root:
path: /
pool: {{storage_pool}}
pool: default
type: disk
name: default
# --
projects:
@ -42,4 +45,5 @@ projects:
features.networks: "true"
features.profiles: "true"
features.storage.volumes: "true"
name: {{lxd_project_name}}
description: Default LXD project
name: default

File diff suppressed because one or more lines are too long