title: ansible-playbook extra vars passing from command line
body: <p>My playbook looks like:</p>
  
  <pre><code>---
  
  - name: Install and configure AD authentication
    hosts: test
     become: yes
     become_user: root
  
    vars:
      hostname: "{{ host_name }}"
  
  
    vars_prompt:
      - name: "bind_password"
        prompt: "Password for xxx.local\\user"
        private: yes
  
    tasks:
  
      - name: Ansible prompt example.
        debug:
          msg: "{{ bind_password }}"
  
      - name: Ansible prompt example.
        debug:
          msg: "{{ host_name }}"
  </code></pre>
  
  <p>and i am using below command to pass the variable 
       ansible-playbook hostname_set.yml --extra-vars "host_name= 'xxx.xxx.local'"</p>
  
  <p>but i am not getting exact variable value what i am using for setting up hostname.</p>
  
  <pre><code>Password for xxx.xxx\user:
  PLAY [Install and configure AD authentication] 
  TASK [Gathering Facts] 
   ok: [x.x.x.x]
  TASK [Ansible prompt example.] 
       ok: [x.x.x.x] =&gt; {
          "msg": "wel"
  }
  TASK [Ansible prompt example.] 
  ok: [x.x.x.x] =&gt; {
      "msg": ""
  }
   TASK [Setup the hostname] 
   changed: [x.x.x.x]
   PLAY RECAP 
   x.x.x.x              : ok=4    changed=1    unreachable=0    failed=0    
   skipped=0    rescued=0    ignored=0
  </code></pre>