Youd need a relay for sure
You'd need a normally closed relay so that when the ignition is on, the lights would be on, but when the headlights are on this will trigger the relay therefore opening the contacts
The trigger wire would be the live the the headlights