host file doesn't read variable for windows

Hello,
my host file for ansible is not reading additional variables. Following is my host file:

[ubuntu]

[amazonlinux2]

[database]

[windows]

[windows:vars]
ansible_connection = winrm
ansible_ssh_port = 5986
ansible_winrm_transport = kerberos
ansible_winrm_server_cert_validation = ignore
validate_certs = false

playbook:

  • hosts: windows_server
    vars:
    ansible_connection: winrm
    ansible_ssh_port: 5986
    anisble_winrm_transport: kerberos
    ansible_winrm_server_cert_validation: ignore
    validate_certs: false
    ansible_winrm_scheme: https
    ansibe_winrm_read_timeout_sec: 30
    ignore_unreachable: true
    gather_facts: false

If I add [windows_server] call it back the playbook, it won’t read it for some reason and throws out the following error:

<test.domain.com> ESTABLISH WINRM CONNECTION FOR USER: None on PORT 5986 TO test.domain.com
fatal: [test.domain.com]: UNREACHABLE! => {
“changed”: false,
“msg”: “ssl: auth method ssl requires a username”,
“unreachable”: true

It’s using Kerberos authentication where it works for other playbooks. I double-checked by entering -klist and ticket are there.

Any idea why it won’t work?

Thanks,
Jimmy

  1. You have a typo when you specify kerberos auth, it should be ‘ansible_winrm_transport’ but you have ‘anisble_winrm_transport’
  2. validate_certs: false doesn’t affect WinRM cert validation, that’s just a standard var
  3. You shouldn’t have to set ansible_winrm_read_timeout_sec at all, it’s rarely ever needed
  4. You are saying to run on windows_server, based on your hosts file it’s not part of any groups, the windows group doesn’t have a member anyway so those vars won’t apply