The get_url module can take a md5sum that can be used to avoid repeated
downloads.

There is also a "force" parameter which can avoid downloads if the file is
already there.

If using sudo, however, sometimes this force detection, due to permissions,
can not engage.



On Wed, Nov 5, 2014 at 10:32 AM, Brian Coca <bc...@ansible.com> wrote:

> not sure why you need to encapsulate at role level, just put both plays in
> same file.
>
> you cannot do host selection at roles anyway, that is a play property
>
> On Wed, Nov 5, 2014 at 10:00 AM, Torsten Reinhard <i...@torstenreinhard.de
> > wrote:
>
>> Thanx, Brian,
>>
>> sounds like an easy solution - but what about encapsulation? I need to
>> break down things than into
>> - preparation steps (artifact to be downloaded)
>> - roles that are executed - and depend on those artifacts
>>
>> Can I keep all "encapsulated" in one role ?
>>
>> Thx, Torsten
>>
>> Am Dienstag, 4. November 2014 14:19:18 UTC+1 schrieb Brian Coca:
>>>
>>> separate it into 2 plays, the first using hosts: localhost (or the
>>> control server), this runs all the tasks you only want to run once
>>> (downloads), the 2nd play can have the deploy to the target hosts.
>>>
>>> You can have multiple plays per file and per invocation.
>>>
>>> On Tue, Nov 4, 2014 at 7:00 AM, Torsten Reinhard <
>>> in...@torstenreinhard.de> wrote:
>>>
>>>> Hi,
>>>>
>>>> we are working on some playbooks that will deploy Maven artifacts
>>>> (*.tar, *.zip) to our target environments.
>>>> Due to the fact the target environment cannot directly access the Nexus
>>>> Server (artifact repository) we need first to download them onto the
>>>> control-machine
>>>> - and copy/ synchronize from there to the target servers.
>>>>
>>>> When we implement the "download from Nexus" as just a simple task
>>>> (inside a role) - it would be executed for each host when the playbook is
>>>> run.
>>>> for( host : hosts )
>>>> {
>>>>   task: download
>>>>   task: copy to host
>>>>   task: install to host
>>>> }
>>>>
>>>> Is there any way to execute "run only once" tasks, before looping over
>>>> all hosts is executed ?
>>>>
>>>> pre-task: download
>>>> for( host : hosts )
>>>> {
>>>>   task: copy to host
>>>>   task: install to host
>>>> }
>>>>
>>>> Some kind of "hook" where we can put preparation tasks ?
>>>>
>>>> Thanx for any hints,
>>>>
>>>> Torsten
>>>>
>>>>  --
>>>> 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-proje...@googlegroups.com.
>>>> To post to this group, send email to ansible...@googlegroups.com.
>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>> msgid/ansible-project/1c8a50dc-1d2d-4533-903a-
>>>> 54570a935014%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/ansible-project/1c8a50dc-1d2d-4533-903a-54570a935014%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Brian Coca
>>>
>>  --
>> 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/7f94f1f9-6ab3-415a-852a-499cb63f85b4%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/7f94f1f9-6ab3-415a-852a-499cb63f85b4%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Brian Coca
>
> --
> 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/CAJ5XC8nhu9AHeB%3D5TWZju5Bp%2Bmt6xY5sfxC3W5KMeSwN02jzOA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAJ5XC8nhu9AHeB%3D5TWZju5Bp%2Bmt6xY5sfxC3W5KMeSwN02jzOA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnsWgzuD1Za2Xnt4CcnatZMw5sc-v%2BdF0FF08Ota2xW9%3DvwSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to