title: Ansible: How to declare global variable within playbook?
body: <p>How can I declare global variable within Ansible playbook. I have searched in google and found the below solution, but its not working as expected.</p>
  
  <pre><code>- hosts: all
    vars:
      prod-servers:
       - x.x.x.x
       - x.x.x.x
  
  
  - hosts: "{{prod-servers}}"
    tasks:
    - name: ping
      action: ping
  </code></pre>
  
  <p>When I'm trying the above code, it says variable <code>prod-servers</code> is undefined.</p>