43 lines
1.8 KiB
YAML
43 lines
1.8 KiB
YAML
---
|
|
- name: Routes | Render HTTP IngressRoute CRD manifests
|
|
ansible.builtin.template:
|
|
src: ingressroute.yml.j2
|
|
dest: "/tmp/traefik-route-{{ item.name }}.yml"
|
|
mode: "0600"
|
|
loop: "{{ (traefik_port_map | rejectattr('protocol', 'defined') | list) + (traefik_port_map | selectattr('protocol', 'defined') | rejectattr('protocol', 'equalto', 'tcp') | list) }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
|
|
- name: Routes | Apply HTTP IngressRoute CRD manifests
|
|
ansible.builtin.command: >
|
|
kubectl apply -f /tmp/traefik-route-{{ item.name }}.yml
|
|
environment:
|
|
KUBECONFIG: "{{ traefik_kubeconfig }}"
|
|
PATH: "/usr/local/bin:/usr/bin:/bin"
|
|
loop: "{{ (traefik_port_map | rejectattr('protocol', 'defined') | list) + (traefik_port_map | selectattr('protocol', 'defined') | rejectattr('protocol', 'equalto', 'tcp') | list) }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
register: _route_apply
|
|
changed_when: "'configured' in _route_apply.stdout or 'created' in _route_apply.stdout"
|
|
|
|
- name: Routes | Render TCP IngressRouteTCP CRD manifests
|
|
ansible.builtin.template:
|
|
src: ingressroute-tcp.yml.j2
|
|
dest: "/tmp/traefik-route-{{ item.name }}.yml"
|
|
mode: "0600"
|
|
loop: "{{ traefik_port_map | selectattr('protocol', 'defined') | selectattr('protocol', 'equalto', 'tcp') | list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
|
|
- name: Routes | Apply TCP IngressRouteTCP CRD manifests
|
|
ansible.builtin.command: >
|
|
kubectl apply -f /tmp/traefik-route-{{ item.name }}.yml
|
|
environment:
|
|
KUBECONFIG: "{{ traefik_kubeconfig }}"
|
|
PATH: "/usr/local/bin:/usr/bin:/bin"
|
|
loop: "{{ traefik_port_map | selectattr('protocol', 'defined') | selectattr('protocol', 'equalto', 'tcp') | list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
register: _route_tcp_apply
|
|
changed_when: "'configured' in _route_tcp_apply.stdout or 'created' in _route_tcp_apply.stdout"
|