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:
And also have a a group_var file called "inventory/group_var/datacenter" that would contain:
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.