Hi all,

I decided to go for the 1st solution (/etc/hosts updates) inspired by the 
following resources:
- https://gist.github.com/rothgar/8793800
- https://github.com/holms/ansible-fqdn

The desired behavior is the following (idempotent actions) :
- query the inventory to find candidate hosts (ex: groups["test.app*"])
- for each host in candidate_hosts update /etc/host with aliases (ex: 
update /etc/host so that it contains alias and IP for index, db, log-server)
- for each host in candidate_hosts generate app configuration files to 
reference index, db, log-server aliases

I'll let you know if I get any result.

Regards,

Louis


Le mercredi 14 janvier 2015 17:23:11 UTC+1, louis gueye a écrit :
>
> Hi all,
>
> First I would like to thank Ansible creators and its great community 
> because this tool really simplifies my day to day life.
>
> I have the following workflow and I want a piece of advice on *Step 3*:
>
>    - Step 1: create n nodes with a cloud provider (lb, app-1, app-2, 
>    index, index-upgrader, db, db-upgrader, log-server, log-store, log-viewer) 
> (*done 
>    with any cloud module*)
>    - Step 2: generate an inventory with IP/hostnames gathered from my 
>    cloud provider (*done with dynamic inventory modules*).
>    - *Step 3*: link nodes by alias so that they have knowledge of each 
>    other:
>    
>
>    1. log-viewer references log-store
>       2. log-server references log-store
>       3. index-upgrader references index
>       4. db-upgrader references db
>       5. app-{1,2} references index, db, log-server
>       6. lb references app-{1,2}
>    
>
>    - Step 4: provision and configure nodes with no hardcoded IP adress, 
>    only aliases defined in step 3 (*regular ansible stuff*)
>
> Solution 1: for each node, generate (with templates and lineinfile 
> directive) the proper hosts file on the nodes manager (the node that runs 
> ansible and the playbook) and copy the hosts file to the node.
> That solution would surely work but I was wondering if there were a more 
> elegant way.
> Solution 2: use a DNS server. It would also do the trick but it's rather 
> complex for my needs.
> Solution 3: An elegant solution would be to "describe" the linking 
> requirements (like it is done in terraform.io but I don't want to use 
> another tool, so far ansible covers all my needs) in a file and the module 
> would look-up relevant information in the inventory, generate linking 
> artifacts (host files, or whatever) and apply them to corresponding nodes.
>
> Thank you for your advices.
>
> Regards,
>
> Louis
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/eddcbd39-c90a-4fea-9682-f4384b13401b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to