Custom module will work best in your case.
We are using the same approach but with more sources of asset. This module 
is basically used in every software installation role and separate role is 
not an option.

1) Check if file is already present in destination directory
2) Download from /opt/repository/app (mount of software repository for 
installations with Vagrant)
3) Download from http://reposerver/app or s3://repobucket/app
4) Download from internet

- name: Get Packer installer
  get_installer: >
    name={{ packer_installer }}
    dest={{ packer_install_home }}
    repo={{ repo_app_base }}
    path={{ packer_repo_path }}
    repo_url={{ repo_app_url }}
    url={{ packer_url }}
  sudo: yes

Where
 packer_installer: '{{ packer_version }}_linux_386.zip'
 packer_repo_path: HashiCorp/Packer/{{ packer_version }}
 packer_url: https://dl.bintray.com/mitchellh/packer/{{ packer_installer }}
 repo_app_base: /opt/repository/app
 repo_app_url: http://reposerver/app (or s3://repobucket/app)

So module searches in
1) /opt/install/packer/0.5.1_linux_386.zip (destination)
2) /opt/repository/app/HashiCorp/Packer/0.5.1/0.5.1_linux_386.zip (nfs 
mount)
3) http://reposerver/app/HashiCorp/Packer/0.5.1/0.5.1_linux_386.zip (http 
server) or s3://repobucket/app/HashiCorp/Packer/0.5.1/0.5.1_linux_386.zip
4) https://dl.bintray.com/mitchellh/packer/0.5.1_linux_386.zip

Drawback - none of your roles can be shared in Ansible Galaxy.

On Saturday, March 1, 2014 1:19:45 PM UTC+3, Jason Sheedy wrote:
>
> Thanks for the feedback guys. I think, as James suggested, the simplest 
> way would be to download all the assets in a separate role. 
>
> That sayid, I was hoping to download / sync to the asset server in an 
> addhock fashion in various roles. To do that I think it would be easier to 
> write a custom module than piecing together a long list of calls to 
> standard modules every time I need an asset. As an example, I'm thinking 
> something like this would be good:
>
> tasks
>
> - name: download asset and sync to asset server
>   url: http://www.some.com/asset.tar.gz
>   dest: /var/assets
>   asset_host: root@my.asset.server
>
> This would download the asset if if doesn't exist on the asset server and 
> syncronise with the local file system. The dest directory could be mirrored 
> between the asset server and the host machine.
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b28a40b0-0815-4fe5-8759-29af299fbe37%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to