Hi everyone.
I encounter an issue while attempting to encrypt the ansible_password using ansible-vault for connecting to a Windows host with WinRM. Once the password is encrypted and inserted into the vars/main.yaml file, the playbook fails to recognize it for connecting to the host.
Here my playbook:
#test.yaml
---
- hosts: servers
roles:
- windows
inventory:
[servers]
IP
[servers:vars]
ansible_user=user
ansible_port=5985
ansible_connection=winrm
ansible_winrm_scheme=http
ansible_winrm_server_cert_validation=ignore
ansible_winrm_kerberos_delegation=true
How are you telling ansible what the vault password is?
According to Ansible-Vault and Ansible Config Settings documentation, there are a couple different ways to tell Ansible what your vault password is.
For my local development stuff, I put my vault password into a text file and then set the ANSIBLE_VAULT_PASSWORD_FILE environment variable to that file location. That way, ansible knows where to find my ansible-vault password and can decrypt the vault to read the contents.
As a simple test to see if any of the special characters in your passwords are messing with the Ansible interpreters, try removing all special characters from the password.
If you must have a special character, use underscore “_” or pound “#”. Those don’t have special meaning in most languages.