Is there any way to manange the ansible host file?

I would like to add/remove hosts/groups on this file (in a permanent way). I’ve been looking in the Inventory object but there is no save method there.

Thanks!

Nope, there’s not.

You can use AnsibleWorks AWX if you want a REST API to manage inventory (and a database).

Or you can use an external inventory script to pull inventory from remote software defined sources of other kinds.