{
  "variables": {
    "repository_url": null,
    "revision": null,
    "role": null
  },
  "builders": [
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline_shebang": "/bin/bash -x",
      "inline": [
        "if [ ! -d /opt/cloudconductor/patterns ]; then",
        "  sudo mkdir -p /opt/cloudconductor/patterns",
        "fi",

        "sudo git clone {{user `repository_url`}} /opt/cloudconductor/patterns",

        "cd /opt/cloudconductor/patterns/*",
        "git checkout {{user `revision`}}",

        "if [ -f ./events/init/user-setup ]; then",
        "  sudo /opt/chefdk/embedded/bin/ruby ./events/init/user-setup",
        "fi"
      ]
    }
  ]
}

{
  "variables": {
    "repository_url": null,
    "revision": null,
    "role": null
  },
  "builders": [
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline_shebang": "/bin/bash -x",
      "inline": [
        "if [ ! -d /opt/cloudconductor/patterns ]; then",
        "  sudo mkdir -p /opt/cloudconductor/patterns",
        "fi",

        "sudo git clone {{user `repository_url`}} /opt/cloudconductor/patterns",

        "cd /opt/cloudconductor/patterns/*",
        "git checkout {{user `revision`}}",

        "if [ -f ./events/init/user-setup ]; then",
        "  sudo SERF_TAG_ROLE={{user `role`}} /opt/chefdk/embedded/bin/ruby ./events/init/user-setup",
        "fi"
      ]
    }
  ]
}

Add SERF_TAG_ROLE environment variable to notice role to user-setup script
Add SERF_TAG_ROLE environment variable to notice role to user-setup script
