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?
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
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:
-
Exactly match an account on the windows machine with admin privileges (account must exist but need NOT be current active login)
-
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.