--- - name: set ip and hosts to hosts file hosts: server become: yes tasks: - name: ensure ip and hosts setted copy: src: hosts dest: /etc/hosts owner: root group: root mode: u=rw,g=r,o=r