46 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
---
 | 
						|
- name: configure dnsmasq hosts
 | 
						|
  lineinfile:
 | 
						|
    dest: /etc/dnsmasq.d/hosts.conf
 | 
						|
    regexp: "^{{ ansible_host }}"
 | 
						|
    line: "{{ ansible_host }}\t{{ inventory_hostname }}.lxc.br0tkasten.de"
 | 
						|
  notify:
 | 
						|
    - reload dnsmasq
 | 
						|
  delegate_to: localhost
 | 
						|
  connection: local
 | 
						|
 | 
						|
- name: create container
 | 
						|
  lxd_container:
 | 
						|
    name: "{{ inventory_hostname }}"
 | 
						|
    state: started
 | 
						|
    source:
 | 
						|
      type: image
 | 
						|
      mode: pull
 | 
						|
      server: https://images.linuxcontainers.org
 | 
						|
      protocol: simplestreams #lxd # if you get a 404, try setting protocol: simplestreams
 | 
						|
      alias: "{{ container_image }}"
 | 
						|
    devices: '{ "eth0": {"nictype":"bridged", "parent":"lxd","type":"nic","ipv4.address":"{{ ansible_host }}"} }'                                   # default to {}
 | 
						|
    profiles: ["lxd"]
 | 
						|
    wait_for_ipv4_addresses: true
 | 
						|
    timeout: 120
 | 
						|
  delegate_to: localhost
 | 
						|
  connection: local
 | 
						|
 | 
						|
- name: setup alpine 
 | 
						|
  include: alpine.yml
 | 
						|
  when: '"alpine" in container_image'
 | 
						|
 | 
						|
- name: setup archlinux
 | 
						|
  include: archlinux.yml
 | 
						|
  when: '"archlinux" in container_image'
 | 
						|
 | 
						|
- name: setup rockylinux
 | 
						|
  include: rockylinux.yml
 | 
						|
  when: '"rockylinux" in container_image'
 | 
						|
 | 
						|
- name: deploy motd
 | 
						|
  copy:
 | 
						|
    src: motd
 | 
						|
    dest: /etc/motd
 | 
						|
    mode: 0644
 |