Same code on many devices

I’ve made a device based on ESP home, that I want in multiple copies. Copy pasting the yaml to 10+ devices isn’t really my favorite dish, and it is also a nightmare if I want to change something in the code on all the devices.

Is there a way to reference parts of my code from a file in home assistant and have the content of that file compiled onto the device when I make installs? I looked at !include. I am not entirely sure, but it appears to just point to a ressource when the code runs, essentially resulting in a much higher bandwidth usage and resulting battery consumption because the file content has to be downloaded.