title: Keep Ansible DRY: How to avoid repeating variables?
body: <p>Recently just started using Ansible and I have run into a problem. In one of my YAML structures I have defined something like this:</p>
  
  <pre><code>---
  # file: main.yml
  #
  # Jenkins variables for installation and configuration
  
  jenkins:
    debian:
      # Debian repository containing Jenkins and the associated key for accessing the repository
      repo: 'deb http://pkg.jenkins-ci.org/debian binary/'
      repo_key: 'http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key'
  
      # Dependencies needed for Jenkins to run properly
      dependencies:
        - 'openjdk-7-jdk'
        - 'git-core'
        - 'curl'
  
    port: 8080
  
    # Installation directory
    home: '/opt/jenkins'
  
    # Path to the location of the main Jenkins-cli binary
    bin_path: '{{jenkins.home}}/jenkins-cli.jar'
  
    # Path to the location of the Jenkins updates file
    updates_path: '{{jenkins.home}}/updates_jenkins.json'
  </code></pre>
  
  <p>Ansible gives me an error like this from a specific task:</p>
  
  <blockquote>
    <p>"recursive loop detected in template string:
    {{jenkins.home}}/updates_jenkins.json"</p>
  </blockquote>
  
  <p>I've narrowed it down to the problem being with the fact bin_path and updates_path both refer to 'home'. Is there a way around this? It kind of sucks that I would need to define '/opt/jenkins' multiple times.</p>