--- - set_fact: delayed_job_installed="true" - name: Install systemd delayed_job script become: true vars: job_queue: "{{ item }}" loop_index: "{{ loop_index }}" template: src: delayed-job-systemd.service dest: /etc/systemd/system/delayed_job_{{ item }}{{ loop_index }}.service loop: "{{ job_queues }}" loop_control: index_var: loop_index loop_var: item - name: Enable systemd delayed_job service become: true systemd: name: "delayed_job_{{ item }}{{ loop_index }}" daemon_reload: true enabled: yes state: started loop: "{{ job_queues }}" loop_control: loop_var: item index_var: loop_index