--- - name: generate systemd socket units loop: "{{ whawty_auth_app.config.listeners | dict2items }}" loop_control: label: "{{ item.key }}" template: src: systemd.socket.j2 dest: "/etc/systemd/system/whawty-auth-{{ whawty_auth_app.name }}_{{ item.key }}.socket" - name: make sure systemd socket units are enabled and started loop: "{{ whawty_auth_app.config.listeners | dict2items }}" loop_control: label: "{{ item.key }}" systemd: daemon_reload: yes name: "whawty-auth-{{ whawty_auth_app.name }}_{{ item.key }}.socket" state: started enabled: yes