- name: set /etc/hosts in managed hosts hosts: all,localhost remote_user: student gather_facts: yes tasks: - name: template render template: src: hosts.j2 dest: /etc/hosts