or just run with ignore_errors: true, it will fail when the template source
dooesn't exist

On Thu, Nov 6, 2014 at 3:15 PM, Michael Peters <[email protected]>
wrote:

> You can combine the stat module with local_action and save the
> results. Then use those results in the conditional.
>
> On Thu, Nov 6, 2014 at 3:08 PM, Jordi Funollet <[email protected]>
> wrote:
> > I'm trying to have a template uploaded only if the template exists
> > *locally*. My use case is having a bunch of items with common parts
> > configured on the same role. Something like
> >
> >     -  template: src=nginx/{{ item }}.j2 dest={{ nginx_sites_dir }}/{{
> >     item }}
> >        with_items: apps
> >        when: file_exists|nginx/{{ item }}.j2
> >
> >     -  template: src=uwsgi/{{ item }}.j2 dest={{ uwsgi_dir }}/{{ item }}
> >        with_items: apps
> >        when: file_exists|uwsgi/{{ item }}.j2
> >
> > So for every 'app' it would configure Nginx only if a template exists on
> > 'templates/nginx/' for  this specific app, and likewise for uwsgi.
> >
> > Is there some conditional that could be used here? I could probably live
> > with 'ignore_errors: yes' but this could mask other unintended problems.
> >
> > --
> > Jordi Funollet Pujol
> > http://www.linkedin.com/in/jordifunollet
> >
> > --
> > 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/1415304501.3580326.187961429.610B9E15%40webmail.messagingengine.com
> .
> > 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 [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/CAJQqANfibcjqgc9goiKq8HsHP7BNQeijD3Ow--vXjSXn--DQCw%40mail.gmail.com
> .
> 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 [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/CAJ5XC8kTwnjyULgrk7zLNZ6KhnRDC-kwqLA9Kbg8vyMGqUTWqQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to