Re use automation best way i need help/inputs

I have some automations on lights that are starting to work well, I was thinking of reusing these for more lights and switches. is there any way to, for example, define which entities I want to use in this automation and then call these variables. I thought then that I have a lot of different choice options and it is starting to happen in many places that I need to replace these entities, it would have been great to define these and call them.

You can use scripts which you can pass fields into. Then, call the script from your automation.

Scripts - Home Assistant (

Post the automation and we can see what we can do.
Most likely you can use the trigger variable.