--- - name: render haproxy config ansible.builtin.template: src: "{{ item }}" dest: "/etc/haproxy/{{ item | basename | regex_replace('\\.j2$', '') }}" owner: root group: root mode: '0644' loop: "{{ query('fileglob', role_path + '/templates/' + inventory_hostname + '/*.cfg.j2') }}" notify: restart haproxy