mercredi 29 juillet 2015

How to concatenate EC2 hostnames in config file in Ansible playbook?

I try to write ansible playbook to setup MongoDB shard cluster in Amazon EC2. I create three EC2 instances using ec2 ansible module ( http://ift.tt/1DbCSoR )

- name: Create EC2 instances for MongoConfigs
  ec2:
    key_name: mongo
    ..............
    wait: yes
  register: ec2_config

Ok, ec2_config variable contain created instances list.

Then on all mongos instances I have to start mongos with configDB param: http://ift.tt/1OCCT5U ( You must specify either 1 or 3 configuration servers, in a comma separated list )

For example, I have template:

systemLog:
  destination: file
  path: "/logs/mongodb.log"
  logAppend: true

sharding:
  configDB: {{ configDBHosts }}

How I have to set configDBHosts value like this:

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

?




Aucun commentaire:

Enregistrer un commentaire