become_flags for specific inventory host

Hi,

I have the need to configure become_flags var for some of my inventory hosts (because of old sudo versions not accepting " -H -S -n").
I was trying to do this on my dynamic inventory with hostvars for that host, but doesn’t work, I think become_flags only works for plays and tasks.

Can I handle this in some other way?

Thanks,
Bruno

To place it in hostvars you need to name it ansible_become_flags:

https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#list-of-behavioral-inventory-parameters

Thanks Matt, that worked.