title: rake task variable
body: <p>I have two <strong>Rake tasks</strong> under the same <strong>namespace</strong> like following:</p>
  
  <pre><code>namespace :db do
    task :first_task =&gt; :environment do
           server_name='myserver'
           connect_to(server_name)
    end
  
    task :second_task =&gt; :environment do
            server_name='myserver'
            do_something_with(server_name)
    end
  end
  </code></pre>
  
  <p>As you see, both tasks are under the <strong>same namespace</strong> and both tasks use <code>server_name='myserver'</code> <strong>constant variable</strong>. </p>
  
  <p>It really looks ugly to define the <code>server_name</code> variable twice under the same namespace, how can I have one place defining this variable so both tasks can use it?  </p>