lxd init default config
This commit is contained in:
		
							parent
							
								
									95d9d08762
								
							
						
					
					
						commit
						1d0e5df155
					
				
					 3 changed files with 33 additions and 20 deletions
				
			
		| 
						 | 
					@ -20,7 +20,6 @@
 | 
				
			||||||
    #vars: 
 | 
					    #vars: 
 | 
				
			||||||
    #  - lxd_init_template_config_path="/path/to/my/custom/template"
 | 
					    #  - lxd_init_template_config_path="/path/to/my/custom/template"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
## Rollback
 | 
					## Rollback
 | 
				
			||||||
- hosts: ubuntu_lxd
 | 
					- hosts: ubuntu_lxd
 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
| 
						 | 
					@ -28,4 +27,11 @@
 | 
				
			||||||
  tasks: 
 | 
					  tasks: 
 | 
				
			||||||
  - shell: "snap remove --purge lxd"
 | 
					  - shell: "snap remove --purge lxd"
 | 
				
			||||||
    become: true
 | 
					    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
 | 
					# defaults file for roles/init_lxd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
lxd_init_template_config_path: "templates/default_config.yml.j2"
 | 
					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:
 | 
					networks:
 | 
				
			||||||
- config:
 | 
					- name: {{network_default_name}}
 | 
				
			||||||
    # IPv4
 | 
					  project: {{lxd_project_name}}
 | 
				
			||||||
 | 
					  type: bridge
 | 
				
			||||||
 | 
					  config:
 | 
				
			||||||
 | 
					  # IPv4
 | 
				
			||||||
    ipv4.nat: "true"
 | 
					    ipv4.nat: "true"
 | 
				
			||||||
    ipv4.address: {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}
 | 
					    ipv4.address: {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}
 | 
				
			||||||
    # IPv6
 | 
					  # IPv6
 | 
				
			||||||
    ipv6.nat: "true"
 | 
					    ipv6.nat: "true"
 | 
				
			||||||
  name: lxdbr0
 | 
					 | 
				
			||||||
  type: bridge
 | 
					 | 
				
			||||||
  project: default
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# --
 | 
					# --
 | 
				
			||||||
storage_pools:
 | 
					storage_pools:
 | 
				
			||||||
- config:
 | 
					- name: {{storage_pool}}
 | 
				
			||||||
    size: 20GB
 | 
					  driver: {{storage_pool_driver}}
 | 
				
			||||||
 | 
					  config:
 | 
				
			||||||
 | 
					    size: {{storage_pool_size}}
 | 
				
			||||||
    source: /var/snap/lxd/common/lxd/disks/default.img
 | 
					    source: /var/snap/lxd/common/lxd/disks/default.img
 | 
				
			||||||
  name: default
 | 
					 | 
				
			||||||
  driver: zfs
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# --
 | 
					# --
 | 
				
			||||||
profiles:
 | 
					profiles:
 | 
				
			||||||
- config: {}
 | 
					- name: {{lxd_project_name}}
 | 
				
			||||||
  description: Default LXD profile
 | 
					 | 
				
			||||||
  devices:
 | 
					  devices:
 | 
				
			||||||
    eth0:
 | 
					    eth0:
 | 
				
			||||||
      name: eth0
 | 
					      name: eth0
 | 
				
			||||||
      network: lxdbr0
 | 
					      network: {{network_default_name}}
 | 
				
			||||||
      type: nic
 | 
					      type: nic
 | 
				
			||||||
    root:
 | 
					    root:
 | 
				
			||||||
      path: /
 | 
					      path: /
 | 
				
			||||||
      pool: default
 | 
					      pool: {{storage_pool}}
 | 
				
			||||||
      type: disk
 | 
					      type: disk
 | 
				
			||||||
  name: default
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# -- 
 | 
					# -- 
 | 
				
			||||||
projects:
 | 
					projects:
 | 
				
			||||||
| 
						 | 
					@ -44,5 +42,4 @@ projects:
 | 
				
			||||||
    features.networks: "true"
 | 
					    features.networks: "true"
 | 
				
			||||||
    features.profiles: "true"
 | 
					    features.profiles: "true"
 | 
				
			||||||
    features.storage.volumes: "true"
 | 
					    features.storage.volumes: "true"
 | 
				
			||||||
  description: Default LXD project
 | 
					  name: {{lxd_project_name}}
 | 
				
			||||||
  name: default
 | 
					 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue