Not sure if this comment is going to go in the right place? Anyway, what I mean is add become: true underneath hosts: all, which will tell Ansible that you would like it to sudo for the commands in the playbook. The other setting, user: root tells Ansible which user you wish it to become, which I believe by default is root anyway, but I like to be specific.