Good idea, thanks.

On Wednesday, October 15, 2014 11:54:36 AM UTC-4, James Martin wrote:
>
> Rishi,
>
> Let's assume you have an inventory group called  "datacenter" that holds 
> all of your datacenter machines and an inventory group named "inhouse" that 
> holds all of your in-house machines.
>
> You would then have a group_var file called  "inventory/group_var/inhouse" 
> that would contain:
>
> url: http://my.internal.company.com
>
>
> And also  have a a group_var file called  "inventory/group_var/datacenter" 
> that would contain:
>
> url: http://my.datacenter.company.com
>
>
> your tasks would look something like:
>
> - name: get tmy file
>   get_url: {{ url }}/foo.pkg dest=/tmp/foo.pkg
>
>
>
> When your run your playbook in-house, it's going to use the internal url 
> based on the machine's membership to the inhouse group.  When the physical 
> machines have moved from in-house to datacenter, also change their 
> inventory group membership.  The playbook will now use the datacenter url 
> based on the machine's membership to the datacenter group.
>
>
> - James
>
> On Wednesday, October 15, 2014 11:07:09 AM UTC-4, Rishi wrote:
>>
>> I perform a couple steps during server provisioning in-house prior to 
>> sending out to a data center. We have most installers/packages available on 
>> some internal http servers to speed up retrieving them, I would like to 
>> keep the same playbook but change the url to retrieve installers from 
>> during the run based on current network.
>>
>> Any one have any clever ways to alter the url in a "get_url" command to 
>> choose the local network if on local network else use an external internet 
>> address?
>>
>> i.e.
>> if ansible_ssh_host is in 192.168.0.0/16 do foo else do bar.
>>
>

-- 
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/996e3720-9fb2-4bca-ac79-1f0f3b7e8e7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to