# Display variable value from command line?

**URL:** <https://forum.ansible.com/t/display-variable-value-from-command-line/17953>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [April 10, 2015, 3:46pm UTC](https://forum.ansible.com/t/display-variable-value-from-command-line/17953 "2015-04-10T15:46:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Anderson](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@Jonathan\_Anderson](https://forum.ansible.com/u/Jonathan_Anderson)\
**Post date:** [April 10, 2015, 3:46pm UTC](https://forum.ansible.com/t/display-variable-value-from-command-line/17953/1 "2015-04-10T15:46:36Z")

</div>

I’m suspicious that the variables in my windows.yml file are not being loaded properly. Is there an easy way to display the values of current variables from the command line or do I need to write up a playbook to do this?

for example here is my windows.yml file

ansible\_ssh\_user: ansible  
ansible\_ssh\_password: ansible123  
ansible\_ssh\_port: 5986  
ansible\_connection: winrm

How can I check if these values were actually assigned to the variables?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 10, 2015, 4:52pm UTC](https://forum.ansible.com/t/display-variable-value-from-command-line/17953/2 "2015-04-10T16:52:05Z")

</div>

you can create a template that dumps all variables or if you have a  
short list you can use debug module:

- debug: var=ansible\_ssh\_user

---

<div class="post-metadata">

**Author:** ![Chris\_Church1](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@Chris\_Church1](https://forum.ansible.com/u/Chris_Church1)\
**Post date:** [April 10, 2015, 5:35pm UTC](https://forum.ansible.com/t/display-variable-value-from-command-line/17953/3 "2015-04-10T17:35:45Z")

</div>

>

---

<div class="post-metadata">

**Author:** ![Jonathan\_Anderson](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@Jonathan\_Anderson](https://forum.ansible.com/u/Jonathan_Anderson)\
**Post date:** [April 26, 2015, 1:47am UTC](https://forum.ansible.com/t/display-variable-value-from-command-line/17953/4 "2015-04-26T01:47:44Z")

</div>

Okay this is fixed. I’ve discovered that the values assigned to the variables in ansible\group\_vars\windows.yml namely “ansible\_ssh\_user” and “ansible\_ssh\_pass” must:

1. Exactly match an account on the windows machine with admin privileges (account must exist but need NOT be current active login)

2. If you are using SSL and the value of winrm/config/service/AllowUnencrypted is true (this is the default) the values in ansible\group\_vars\windows.yml must exactly match the username and password that was submitted to generate the SSL web certificate.

In my case I also had to append the computer name with the port number in the inventory like this

[windows]  
ComputerName:5986

(or 5985 for AllowUnedcrypted=“true” type this command in powershell PS C:\winrm set winrm/config/service ‘@{AllowUnencrypted=“true”}’

done.
