Using chown command in ansible?

Assuming the file already exists and you just want to change permissions, you can retrieve user ID and group from Ansible facts and do something like:

- name: Change kubeconfig file permission
  file:
    path: $HOME/.kube/config 
    owner: "{{ ansible_effective_user_id }}"
    group: "{{ ansible_effective_group_id }}"

You can also use ansible_real_group_id / ansible_real_user_id or ansible_user_gid/ansible_user_uid depending on your need.

Please don't forget double quotes around ansible expression.

See this post for details on the difference between real and effective user

See Ansible docs on system variables for all available variables