Generate Ketab & create service principal user

Hi all,

I need to work with a domain environment and for that, I need to perform 2 task

  1. Create a service principal user on windows active directory domain
  2. Generate keytab from windows active directory domain

Is it possible to perform the 2 tasks using ansible? I think that I can generate Keytab using ansible expect - but I dont know if it is the optimal way.

If you have such playbooks i will be happy if you can share them

Thanks