Simple light automation script

Hi,
i am new to home assistant, can you please help me.
i have 8 lights in my room, and i want a button to toggle to lights on a switch.
would be easy when i use the toggle method of the switches.

But this one switch should turn off all 8 lights in the room on or off, so i need a automation when any of these lights is on the automation should first toggle it off, and on the next click it should turn all 8 lights on.

what is the best way to do this?

Set up a Light Group:

image

Settings → Devices & services → Helpers → Create Helper → Group → Light group → [name and add all the lights you want in the group] → Submit.