- hosts: all gather_facts: false vars: count: 5 tasks: - name: Install mpdf on hosts apt: name: mpd state: present - name: setup config on hosts template: src: mpdf.conf.j2 dest: /etc/mpdf{{ item ]].conf owner: root group: root notify: - restart mpd loop: "{{ range(1,count|int + 1) }}"