Homelab/host_init/5-traefik.yml

31 lines
819 B
YAML

- name: Install Traefik on Alpine Linux
hosts: all
tasks:
- name: Enable community packages
ansible.builtin.lineinfile:
path: /etc/apk/repositories
regexp: "^#http://dl-cdn.alpinelinux.org/alpine/v3.18/community"
line: "http://dl-cdn.alpinelinux.org/alpine/v3.18/community"
state: present
- name: Update apk packages
community.general.apk:
update_cache: true
- name: Install traefik with apk
community.general.apk:
name: traefik
- name: Copy traefik config to host
ansible.builtin.copy:
mode: preserve
src: ../host_config/traefik.yml
dest: /etc/traefik/traefik.yaml
- name: Start traefik service
ansible.builtin.service:
name: traefik
state: started
enabled: true