lxd init default config
This commit is contained in:
		
							parent
							
								
									95d9d08762
								
							
						
					
					
						commit
						1d0e5df155
					
				
					 3 changed files with 33 additions and 20 deletions
				
			
		| 
						 | 
				
			
			@ -16,11 +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"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Rollback
 | 
			
		||||
- hosts: ubuntu_lxd
 | 
			
		||||
  tags:
 | 
			
		||||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
| 
						 | 
				
			
			@ -4,38 +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"
 | 
			
		||||
  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:
 | 
			
		||||
| 
						 | 
				
			
			@ -44,5 +42,4 @@ projects:
 | 
			
		|||
    features.networks: "true"
 | 
			
		||||
    features.profiles: "true"
 | 
			
		||||
    features.storage.volumes: "true"
 | 
			
		||||
  description: Default LXD project
 | 
			
		||||
  name: default
 | 
			
		||||
  name: {{lxd_project_name}}
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue