title: Override hosts variable of Ansible playbook from the command line
body: <p>This is a fragment of a playbook that I'm using (<code>server.yml</code>):</p>
  
  <pre><code>- name: Determine Remote User
    hosts: web
    gather_facts: false
    roles:
      - { role: remote-user, tags: [remote-user, always] }
  </code></pre>
  
  <p>My hosts file has different groups of servers, e.g.</p>
  
  <pre><code>[web]
  x.x.x.x
  
  [droplets]
  x.x.x.x
  </code></pre>
  
  <p>Now I want to execute <code>ansible-playbook -i hosts/&lt;env&gt; server.yml</code> and override <code>hosts: web</code> from <code>server.yml</code> to run this playbook for <code>[droplets]</code>.</p>
  
  <p>Can I just override as a one time off thing, without editing <code>server.yml</code> directly?</p>
  
  <p>Thanks.</p>