I think the only time you can exclude the REALM is if you have a default set in the krb5.conf file e.g.
# Default values used by the Kerberos V5 library
[libdefaults]
default_realm = DOMAIN.TLD
dns_lookup_realm = false
dns_lookup_kdc = false
ticket_lifetime = 24h
renew_lifetime = 7d
forwardable = true
rdns = false
My ansible_* vars are being defined by a .yml in the ./inventory dir, but it seems to more or less match what you’re defining inline:
ansible_user: [ USING HASHIVAULT PLUGIN TO LOOKUP VALUE]
ansible_password: [ USING HASHIVAULT PLUGIN TO LOOKUP VALUE]
ansible_connection: winrm
ansible_winrm_transport: kerberos
ansible_winrm_server_cert_validation: ignore
ansible_port: 5985
Now that I think about it, does your password value have symbols?
I recall some issues where a password was not being parsed as expected because of symbols. Advanced playbook syntax — Ansible Community Documentation and
Some examples of how the extra var is processed using a simple play that just outputs the var:
- name: Test string output
ansible.builtin.debug:
msg: "{{ testString }}"
ansible-playbook test.yml --extra-vars testString=test@#$!~%^&*()_-+=
[1] 3311782
bash: *()_-+=: command not found
TASK [Test string output] *******************************************************************************************************************************************************************
ok: [localhost] =>
msg: test@#~%^
Notice it even caused a separate line of bash to execute by the first 2 lines of output
I cant seem to find a way to set an extra var as unsafe, AWX Tower does this by default but that is not really applicable here, only mentioning it in case you’re not familiar with AWX and see similar in search results.
I think you should try to set all your vars in a file where you can easily set !unsafe and see if that helps. Using Variables — Ansible Community Documentation
Make winrm_vars.yml
type or paste code hereansible_user: domainadmin@REALM
ansible_password: !unsafe 234%234{435lkj{{lkjsdf
ansible_connection: winrm
ansible_winrm_transport: kerberos
ansible_winrm_cert_validation: ignore
Then run this to test:
ansible all -i "dc01"-m win_ping --extra-vars "@winrm_vars.yml"
Example of how tagging unsafe preserves the value as expected
test_vars.yml
unsafeString: !unsafe test@#$!~%^&*()_-+=
ansible-playbook test.yml --extra-vars @"test_vars.yml"
TASK [Test string output] *******************************************************************************************************************************************************************
ok: [localhost] =>
msg: test@#$!~%^&*()_-+=