Compare commits

...

2 Commits

Author SHA1 Message Date
RDF 1d0e5df155 lxd init default config 2022-07-19 10:22:58 -03:00
RDF 95d9d08762 Primeros commits 2022-07-17 01:35:08 -03:00
8 changed files with 36 additions and 1954 deletions

View File

View File

View File

@ -16,10 +16,9 @@
- "zfsutils-linux"
- ansible.builtin.include_role:
name: init_lxd
name: init_lxd
#vars:
# - lxd_init_template_config_path="/path/to/my/template"
# - lxd_init_template_config_path="/path/to/my/custom/template"
## Rollback
- hosts: ubuntu_lxd
@ -28,4 +27,11 @@
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

@ -1,29 +0,0 @@
---
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,4 +1,14 @@
---
# 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_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"

View File

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

View File

@ -4,39 +4,36 @@ config:
# --
networks:
- config:
# IPv4
- name: {{network_default_name}}
project: {{lxd_project_name}}
type: bridge
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:
- config:
size: 20GB
- name: {{storage_pool}}
driver: {{storage_pool_driver}}
config:
size: {{storage_pool_size}}
source: /var/snap/lxd/common/lxd/disks/default.img
name: default
driver: zfs
# --
profiles:
- config: {}
description: Default LXD profile
- name: {{lxd_project_name}}
devices:
eth0:
name: eth0
network: lxdbr0
network: {{network_default_name}}
type: nic
root:
path: /
pool: default
pool: {{storage_pool}}
type: disk
name: default
# --
projects:
@ -45,5 +42,4 @@ projects:
features.networks: "true"
features.profiles: "true"
features.storage.volumes: "true"
description: Default LXD project
name: default
name: {{lxd_project_name}}

File diff suppressed because one or more lines are too long