ansible/02_lxc_containers.yaml

45 lines
1.3 KiB
YAML
Raw Normal View History

2022-03-01 23:30:08 +00:00
---
- name: LXD Playbook
hosts: lxd_hosts
become: true
tasks:
- name: Create lxd containers
community.general.lxd_container:
name: '{{ item }}'
state: started
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:
- haproxy
- gitea
- 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'
- name: Create gitea port forward(s)
community.general.lxd_container:
name: gitea
devices:
map_port_2222:
type: proxy
listen: tcp:0.0.0.0:2222
connect: tcp:127.0.0.1:2222
proxy_protocol: 'true'