{ "desc": "Main",
  "actor": "group.Sync",
  "options": {
    "acts": [
      { "desc": "Hipchat: Notify Oncall Room", "actor": "hipchat.Message", "options": { "message": "Beginning release %RELEASE%", "room": "Oncall" } },

      { "desc": "Clone and Patch Arrays",
        "actor": "group.Sync",
        "options": { "acts": [

          { "desc": "Clone Arrays",
            "actor": "group.Async",
            "options": { "acts": [
              { "desc": "Clone Tools", "actor": "rightscale.server_array.Clone", "options": { "dest": "prod-tools-%RELEASE%", "source": "kingpin-integration-testing" } },
              { "desc": "Clone Photos", "actor": "rightscale.server_array.Clone", "options": { "dest": "prod-photos-%RELEASE%", "source": "kingpin-integration-testing" } },
              { "desc": "Clone Tasks", "actor": "rightscale.server_array.Clone", "options": { "dest": "prod-task-%RELEASE%", "source": "kingpin-integration-testing" } }
            ] }
          },

          { "desc": "Patch Arrays",
            "actor": "group.Async",
            "options": { "acts": [
              { "desc": "Patch Tools", "actor": "rightscale.server_array.Update", "options": { "array": "prod-tools-%RELEASE%", "puppet_facts": "tools=%RELEASE%" } },
              { "desc": "Patch Photos", "actor": "rightscale.server_array.Update", "options": { "array": "prod-photos-%RELEASE%", "puppet_facts": "photos=%RELEASE%" } },
              { "desc": "Patch Tasks", "actor": "rightscale.server_array.Update", "options": { "array": "prod-task-%RELEASE%", "puppet_facts": "task=%RELEASE%" } }
            ] }
          }
        ] }
      },
    
      { "desc": "Join New Arrays to ELB",
        "actor": "group.Async",
        "options": { "acts": [
          { "desc": "Join Tools", "actor": "rightscale.server_array.Execute", "options": { "array": "prod-tools-%OLD_RELEASE%", "script": "Connect instance to ELB", "inputs": { "ELB_NAME": "text:prod-tools" } } },
          { "desc": "Join Photos", "actor": "rightscale.server_array.Execute", "options": { "array": "prod-photos-%OLD_RELEASE%", "script": "Connect instance to ELB", "inputs": { "ELB_NAME": "text:prod-photos" } } }
        ] }
      },

      { "desc": "Wait for traffic to settle",
        "actor": "misc.Sleep",
        "options": { "sleep": 60 } },
  
      { "desc": "Remove Old Arrays from ELB",
        "actor": "group.Async",
        "options": { "acts": [
          { "desc": "Remove Old Tools", "actor": "rightscale.server_array.Execute", "options": { "array": "prod-tools-%OLD_RELEASE%", "script": "Disconnect instance from ELB", "inputs": { "ELB_NAME": "text:prod-tools" } } },
          { "desc": "Remove Old Photos", "actor": "rightscale.server_array.Execute", "options": { "array": "prod-photos-%OLD_RELEASE%", "script": "Disconnect instance from ELB", "inputs": { "ELB_NAME": "text:prod-photos" } } }
        ] }
      }
    ]
  }
}
