Versions prior to 2018 didn't have CLI for activation, only a GUI one: https://docs.unity3d.com/2017.4/Documentation/Manual/ManualActivationGuide.html
Which means that the only way to activate them headlessly is by creating the .ulf ourselves.
It contains a bunch of encrypted HWIDs but we could workaround all of that just by using @unityhub/unity-editor-license node library which could be extracted from the unityhub asar