title: How can I take a list of server names and append a resource URI and port to each?
body: <p>I merged two lists from an Ansible inventory:</p>
  
  <pre><code>set_fact:
    fact1: "{{ groups['group1'] + groups[group2']|list }}
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>fact1:
    - server01
    - server02
    - server03
  </code></pre>
  
  <p>With the above results, I need to append <code>https://</code> to the front, and a port number to the back of each element.
  Then I need to convert it to a comma delimited list for a server config.</p>
  
  <p>In this example I want: <code>https://server01:8000,https://server02:8000,https://server03:8000</code>.</p>
  
  <p>I tried using a join:</p>
  
  <pre><code>set_fact:
    fact2: "{{ fact1|join(':8000,') }}"
  </code></pre>
  
  <p>which partly worked but it left the last server without a port.</p>
  
  <p>How can I achieve my goal?</p>