ansible/02_lxc_containers.yaml

39 lines
1.2 KiB
YAML

---
- name: LXD Playbook
hosts: lxd_hosts
become: true
tasks:
- name: Create lxd containers
community.general.lxd_container:
name: '{{ item.name }}'
state: '{{ item.state }}'
source:
type: image
mode: pull
server: https://cloud-images.ubuntu.com/minimal/releases/
protocol: simplestreams # if you get a 404, try setting protocol: simplestreams
alias: focal
profiles: ['default']
wait_for_ipv4_addresses: true
timeout: 600
with_items:
- { name: haproxy, state: started }
- { name: gitea, state: started }
- { name: freescout, state: started }
- { name: saucy, state: started }
- { name: pretalx, state: stopped }
- name: Create haproxy port forwards
community.general.lxd_container:
name: haproxy
devices:
map_port_80:
type: proxy
listen: tcp:0.0.0.0:80
connect: tcp:127.0.0.1:80
proxy_protocol: 'true'
map_port_443:
type: proxy
listen: tcp:0.0.0.0:443
connect: tcp:127.0.0.1:443
proxy_protocol: 'true'