title: How to concatenate EC2 hostnames in config file in Ansible playbook?
body: <p>I try to write ansible playbook to setup MongoDB shard cluster in Amazon EC2.
  I create three EC2 instances using ec2 ansible module ( <a href="http://docs.ansible.com/ansible/ec2_module.html" rel="nofollow">http://docs.ansible.com/ansible/ec2_module.html</a> )</p>
  
  <pre><code>- name: Create EC2 instances for MongoConfigs
    ec2:
      key_name: mongo
      ..............
      wait: yes
    register: ec2_config
  </code></pre>
  
  <p>Ok, ec2_config variable contain created instances list.</p>
  
  <p>Then on all mongos instances I have to start mongos with configDB param: <a href="http://docs.mongodb.org/manual/reference/configuration-options/#sharding.configDB" rel="nofollow">http://docs.mongodb.org/manual/reference/configuration-options/#sharding.configDB</a>
  ( You must specify either 1 or 3 configuration servers, in a comma separated list )</p>
  
  <p>For example, I have template:</p>
  
  <pre><code>systemLog:
    destination: file
    path: "/logs/mongodb.log"
    logAppend: true
  
  sharding:
    configDB: {{ configDBHosts }}
  </code></pre>
  
  <p>How I have to set <strong>configDBHosts</strong> value like this:</p>
  
  <p>ip-10-0-103-87.us-west-2.compute.internal:27019,ip-10-0-103-88.us-west-2.compute.internal:27019,ip-10-0-103-89.us-west-2.compute.internal:27019</p>
  
  <p>?</p>