title: run ansible playbook with sudo
body: <p>I have a playbook and I want to run it with sudo. It is my ansible playbook:</p>
  
  <h3>site.yml</h3>
  
  <pre><code>---
  - name: Server
    hosts: node1
    sudo: yes
    roles:
      - dbserver
  </code></pre>
  
  <p>When I run it I get this:</p>
  
  <pre><code>ansible-playbook -i hosts site.yml
  
  PLAY [Server] ***************************************************************** 
  
  GATHERING FACTS *************************************************************** 
  fatal: [node1] =&gt; Missing sudo password
  
  TASK: [dbserver | installing server] ****************************************** 
  FATAL: no hosts matched or all hosts have already failed -- aborting
  
  
  PLAY RECAP ******************************************************************** 
             to retry, use: --limit @/home/robe/site.retry
  
  node1                      : ok=0    changed=0    unreachable=1    failed=0
  </code></pre>
  
  <p>Then I add the ansible sudo pass on site.yml:</p>
  
  <pre><code>---
  - name: Server
    hosts: node1
    sudo_pass: ubuntu
    roles:
      - dbserver
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>ERROR: sudo_pass is not a legal parameter at this level in an Ansible Playbook
  </code></pre>
  
  <p>Then my questions are:</p>
  
  <ul>
  <li>Do I have add to each tasks the ansible sudo_pass attribute?</li>
  <li>Is there any way to say sudo and sudo_pass in the playbook?</li>
  </ul>