The ONLY recommended answer
The Unicorn configuration files should never be deployed to CD servers. In fact, no part of Unicorn should be deployed to CD servers. Ever.
You need to remove them.
https://github.com/SitecoreUnicorn/Unicorn/issues/398#issuecomment-1250021066
From a technical standpoint, you could alter the original file.
In line 13 of Unicorn.config, change this line:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
To this:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
Now you've enabled the role:require
setting. This will solve the error you describe with "role is not specified attribute".
At this point you can change the next line of configuration from:
<sitecore>
to
<sitecore role:require="StandAlone">
Or whatever role you want Unicorn to be active on. DO NOT ENABLE THIS FOR ContentDelivery
Sorry for all the bolded warnings, but I really can't stress this enough. Unicorn is entirely untested for Content Delivery servers and there could be anything from security problems to configuration problems coming from leaving it active in an environment it was never designed for.
For the curious, WHY isn't this set by default?
Because Unicorn tries its best to stick to the "path of least surprise". Unicorn is being used on a lot of projects < 9.x where config roles were introduced.