FAQ
hi,

given ansible role directory layout:
files
vars
tasks
...

and having files/foo/hostname/somefile I want not only be able to copy
this file like:
- copy src=foo/{{ ansible_hostname }}/somefile dest=...

but also to limit certain steps depending whether such file exist or not...
basically to define variable and condition other steps on it. unfortunately
stat module is limited to remote host.. what's the other way around?


--
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+unsubscribe@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/abc04355-05c1-4acb-bc96-511dc2e247db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Michael DeHaan at Jun 30, 2014 at 10:03 pm
    "I want not only be able to copy this file"

    copy module, but you've got that

    "but also to limit certain steps depending whether such file exist or not."

    when statement

    "basically to define variable and condition other steps on it."

    include_vars + when statement

    "unfortunately stat module is limited to remote host.."

    local_action





    On Mon, Jun 30, 2014 at 5:50 PM, Nick Evgeniev wrote:

    hi,

    given ansible role directory layout:
    files
    vars
    tasks
    ...

    and having files/foo/hostname/somefile I want not only be able to copy
    this file like:
    - copy src=foo/{{ ansible_hostname }}/somefile dest=...

    but also to limit certain steps depending whether such file exist or
    not... basically to define variable and condition other steps on it.
    unfortunately stat module is limited to remote host.. what's the other way
    around?


    --
    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+unsubscribe@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/abc04355-05c1-4acb-bc96-511dc2e247db%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/abc04355-05c1-4acb-bc96-511dc2e247db%40googlegroups.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+unsubscribe@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%2BnsWgxxW5TBn2jRjkVi6FYK0tcPaLF8KopVqy_o8f7e0eT86Q%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Nick Evgeniev at Jun 30, 2014 at 10:18 pm
    the idea was to define variable automatically based on whether file exist
    or not. as a temporary solution i had to declare variable in host_vars. and
    yes i'm using when statement :)

    it looks like 'stat' module doesn't understand the 'magic' of role
    directory layout, so I would have to specify full path.. am I missing
    something?

    On Monday, 30 June 2014 17:03:38 UTC-5, Michael DeHaan wrote:

    "I want not only be able to copy this file"

    copy module, but you've got that

    "but also to limit certain steps depending whether such file exist or
    not."

    when statement

    "basically to define variable and condition other steps on it."

    include_vars + when statement

    "unfortunately stat module is limited to remote host.."

    local_action






    On Mon, Jun 30, 2014 at 5:50 PM, Nick Evgeniev <nevg...@gmail.com
    <javascript:>> wrote:
    hi,

    given ansible role directory layout:
    files
    vars
    tasks
    ...

    and having files/foo/hostname/somefile I want not only be able to copy
    this file like:
    - copy src=foo/{{ ansible_hostname }}/somefile dest=...

    but also to limit certain steps depending whether such file exist or
    not... basically to define variable and condition other steps on it.
    unfortunately stat module is limited to remote host.. what's the other way
    around?


    --
    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 <javascript:>.
    To post to this group, send email to ansible...@googlegroups.com
    <javascript:>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/abc04355-05c1-4acb-bc96-511dc2e247db%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/abc04355-05c1-4acb-bc96-511dc2e247db%40googlegroups.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+unsubscribe@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/940ba5b5-8764-408c-83b1-7dde3e599ff1%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael DeHaan at Jun 30, 2014 at 11:10 pm
    "it looks like 'stat' module doesn't understand the 'magic' of role
    directory layout, so I would have to specify full path.. am I missing
    something?"

    {{ playbook_dir}}/roles/foo/files/bar.txt


    On Mon, Jun 30, 2014 at 6:18 PM, Nick Evgeniev wrote:

    the idea was to define variable automatically based on whether file exist
    or not. as a temporary solution i had to declare variable in host_vars. and
    yes i'm using when statement :)

    it looks like 'stat' module doesn't understand the 'magic' of role
    directory layout, so I would have to specify full path.. am I missing
    something?

    On Monday, 30 June 2014 17:03:38 UTC-5, Michael DeHaan wrote:

    "I want not only be able to copy this file"

    copy module, but you've got that

    "but also to limit certain steps depending whether such file exist or
    not."

    when statement

    "basically to define variable and condition other steps on it."

    include_vars + when statement

    "unfortunately stat module is limited to remote host.."

    local_action





    On Mon, Jun 30, 2014 at 5:50 PM, Nick Evgeniev wrote:

    hi,

    given ansible role directory layout:
    files
    vars
    tasks
    ...

    and having files/foo/hostname/somefile I want not only be able to copy
    this file like:
    - copy src=foo/{{ ansible_hostname }}/somefile dest=...

    but also to limit certain steps depending whether such file exist or
    not... basically to define variable and condition other steps on it.
    unfortunately stat module is limited to remote host.. what's the other way
    around?


    --
    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/abc04355-05c1-4acb-bc96-
    511dc2e247db%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/abc04355-05c1-4acb-bc96-511dc2e247db%40googlegroups.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+unsubscribe@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/940ba5b5-8764-408c-83b1-7dde3e599ff1%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/940ba5b5-8764-408c-83b1-7dde3e599ff1%40googlegroups.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+unsubscribe@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%2BnsWgzRicVUho0PmowaSN9oJ-UhHrVvkOXX_oGAtE%2B0PhMLEA%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupansible-project @
postedJun 30, '14 at 9:50p
activeJun 30, '14 at 11:10p
posts4
users2

2 users in discussion

Michael DeHaan: 2 posts Nick Evgeniev: 2 posts

People

Translate

site design / logo © 2021 Grokbase