You can use the "run" command like this:
task :foo, :hosts => "my.example.com" do
run "curl <your info here>"
end
The "run" command string is typical Ruby, so you can use any string delimiters:
run %{curl -H "x-api-key:MY_API_KEY" -d ... }
And you can embed parameters as usual:
key = "xyz"
run %{curl -H "x-api-key:#{key}" -d ... }
Good info in the comments from Frederick Chung:
The "run" command will run it on all the remote hosts. I'd use run_locally or even just ``.
Use "run" if you want to know that each host does deploy; each host will send its own info to New Relic.
Use "run_locally" if you just want to know that your local script has run, and you don't care to know that each remote host deployed.