Ansible Vault - Issues with Encrypting ansible_password

Bibbi
Sun, 17 Mar 2024 10:50:00 +0000
Get Help

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

vars:

---
ansible_password: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          66303033643362333834373963393231383533333635643334313739383361313238386162313261
          3639623339623335376534316636306133643066656130340a663166343932383632313234623561
          31323466393934613637313734353039363531366138383663333339333562626165623463356530
          6536363164343766300a316162336535656630376532323063333932366535356139386134666435
          63366330303439666139373166373366386161336636653036613438323565383936

ansible.cfg:

[defaults]
vault_password_file = root/open.txt

When executing ansible-playbook -i inventory.ini test.yaml, I encountered the following error:

fatal: [ip]: UNREACHABLE! => { “changed”: false, “msg”: “ssl: auth method ssl requires a password”, “unreachable”: true }

What could be the issue?

6 posts - 3 participants