SetRole.json

{
    "Parameters": {
        "SiteName": {
            "Type": "string",
            "Description": "Name of the site under inetpub"
        },
        "Role": {
            "Type": "string",
            "Description": "Such as Standalone, ContentManagement, ContentDelivery, etc."
        }
    },
    "Variables": {
        "Site.PhysicalPath": "[joinpath(environment('SystemDrive'), 'inetpub', 'wwwroot', parameter('SiteName'))]",
        "WebConfigFile": "[joinpath(variable('Site.PhysicalPath'), 'Web.config')]"
    },
    "Tasks": {
        "SetRole": {
            "Type": "SetXml",
            "Params": {
              "FilePath": "[variable('WebConfigFile')]",
              "XPath": "//configuration/appSettings/add[@key='role:define']",
              "Attributes": [{ "value": "[parameter('Role')]" } ]
            }
        }
    }
}