title: How to copy a variable in Ansible including undefined?
body: <p>I'm trying to pass variables from one role to another role.</p>
  
  <p>So for example I'm using a meta dependency in my ntp role that pulls in timesync. Obviously I don't want to use variables of role ntp in my timesync role.</p>
  
  <pre><code>dependencies:
  - role: timesync
    vars:
      timesyncd_servers: '{{ ntp_servers }}'
    when:
      - ntp_servers is defined
      - ntp_daemon == 'systemd'
  </code></pre>
  
  <p>If I'm now using a jinja test on <code>timesyncd_server</code> in my template file then it is defined (even if <code>ntp_servers</code> is undefined):</p>
  
  <pre><code>{% if timesyncd_servers is defined %}{{ timesyncd_servers }}{% endif %}
  </code></pre>
  
  <p>The problem now is that this if statement doesn't catch an undefined <code>ntp_servers</code> and ansible fails with <code>'ntp_servers' is undefined</code>.</p>
  
  <p>I did try passing it with <code>| default(omit)</code> - that stopped ansible from failing, but the if statement still is true.</p>
  
  <p>Any idea how to copy <code>ntp_servers</code> into <code>timesyncd_servers</code> so that it stays undefined?</p>