22 lines
873 B
YAML
22 lines
873 B
YAML
---
|
|
- name: Middleware | Render BasicAuth CRD manifests
|
|
ansible.builtin.template:
|
|
src: basicauth-middleware.yml.j2
|
|
dest: "/tmp/traefik-middleware-{{ item.name }}.yml"
|
|
mode: "0600"
|
|
loop: "{{ traefik_port_map | selectattr('basicauth.enabled', 'defined') | selectattr('basicauth.enabled') | list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
|
|
- name: Middleware | Apply BasicAuth CRD manifests
|
|
ansible.builtin.command: >
|
|
kubectl apply -f /tmp/traefik-middleware-{{ item.name }}.yml
|
|
environment:
|
|
KUBECONFIG: "{{ traefik_kubeconfig }}"
|
|
PATH: "/usr/local/bin:/usr/bin:/bin"
|
|
loop: "{{ traefik_port_map | selectattr('basicauth.enabled', 'defined') | selectattr('basicauth.enabled') | list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
register: _mw_apply
|
|
changed_when: "'configured' in _mw_apply.stdout or 'created' in _mw_apply.stdout"
|