encryption – How to automatically mount LUKS readers when connecting?

I have three hard drives on my PC, all encrypted with LUKS. When booting from the main drive, I enter my password to unlock it and connect to Ubuntu 18.04. From the file browser, I can click on other encrypted drives and they mount automatically – but I have to click on it to achieve it. I would prefer that these drives be automatically mounted from Ubuntu. I followed the instructions on this page (https://www.howtoforge.com/automatically-unlock-luks-encrypted-drives-with-a-filefile) and Ubuntu failed to start – I had to use the terminal in emergency mode to cancel my changes. Can any one please advise me on how to make this work?