FAQ
Hello guys,

I am trying to get my head around parsing a folder for its files and
creating symlinks for those files found (depth 0) and place them in another
directory.

Example: parse sites-available/ and create symlinks in sites-enabled/ with
relative paths.

I know one can just use the command/shell modules or even create a task and
register the result of a 'ls' command for example and then parse them...
but what about the relative path?
One could also use a script like Apache provides for example: a2ensite but
what about NGINX?

Trying now the 'with_fileglob' but the task just skips...

Cheers.

--
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/2ef77293-7eaf-4c73-8a9e-72ca62b4aef1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Adam Heath at Aug 5, 2014 at 5:07 pm
    On debian, I could install the program 'symlinks'. I don't know if it
    is available elsewhere. It might be able to help.
    On 08/05/2014 12:05 PM, Dan Vaida wrote:
    Hello guys,

    I am trying to get my head around parsing a folder for its files and
    creating symlinks for those files found (depth 0) and place them in
    another directory.

    Example: parse sites-available/ and create symlinks in sites-enabled/
    with relative paths.

    I know one can just use the command/shell modules or even create a
    task and register the result of a 'ls' command for example and then
    parse them... but what about the relative path?
    One could also use a script like Apache provides for example: a2ensite
    but what about NGINX?

    Trying now the 'with_fileglob' but the task just skips...

    Cheers.
    --
    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/2ef77293-7eaf-4c73-8a9e-72ca62b4aef1%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/2ef77293-7eaf-4c73-8a9e-72ca62b4aef1%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/53E10F33.6010303%40brainfood.com.
    For more options, visit https://groups.google.com/d/optout.
  • Dan Vaida at Aug 5, 2014 at 5:22 pm
    Hello,

    I also know some non-ansible ways of doing this, but I am interested to see if it can be done entirely in Ansible.

    Thanks.
    On Aug 5, 2014, at 7:06 PM, Adam Heath wrote:

    On debian, I could install the program 'symlinks'. I don't know if it is available elsewhere. It might be able to help.
    On 08/05/2014 12:05 PM, Dan Vaida wrote:
    Hello guys,

    I am trying to get my head around parsing a folder for its files and creating symlinks for those files found (depth 0) and place them in another directory.

    Example: parse sites-available/ and create symlinks in sites-enabled/ with relative paths.

    I know one can just use the command/shell modules or even create a task and register the result of a 'ls' command for example and then parse them... but what about the relative path?
    One could also use a script like Apache provides for example: a2ensite but what about NGINX?

    Trying now the 'with_fileglob' but the task just skips...

    Cheers.
    --
    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 toansible-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/2ef77293-7eaf-4c73-8a9e-72ca62b4aef1%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/2ef77293-7eaf-4c73-8a9e-72ca62b4aef1%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 a topic in the Google Groups "Ansible Project" group.
    To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/lPawe4hywBA/unsubscribe.
    To unsubscribe from this group and all its topics, 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/53E10F33.6010303%40brainfood.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 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/8B1E3FC4-6C18-4F93-B78D-405CC30A280C%40gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael DeHaan at Aug 7, 2014 at 9:15 pm
    I would have a list of what sites to enable and what sites to disable
    centrally, and do this with a simple with_items instead, because it would
    be better to have a central record than to have potentially hundreds of
    different servers each being their own sources of record.

    - template: src={{ site }}.cfg dest=/path/to/sites-available
       with_items: enable_sites

    - file: src=... dest=...
       with_items: enable_sites

    - file: src=... state=absent
       with_items: disable_sites








    On Tue, Aug 5, 2014 at 1:22 PM, Dan Vaida wrote:

    Hello,

    I also know some non-ansible ways of doing this, but I am interested to
    see if it can be done entirely in Ansible.

    Thanks.
    On Aug 5, 2014, at 7:06 PM, Adam Heath wrote:

    On debian, I could install the program 'symlinks'. I don't know if it
    is available elsewhere. It might be able to help.
    On 08/05/2014 12:05 PM, Dan Vaida wrote:
    Hello guys,

    I am trying to get my head around parsing a folder for its files and
    creating symlinks for those files found (depth 0) and place them in another
    directory.
    Example: parse sites-available/ and create symlinks in sites-enabled/
    with relative paths.
    I know one can just use the command/shell modules or even create a task
    and register the result of a 'ls' command for example and then parse
    them... but what about the relative path?
    One could also use a script like Apache provides for example: a2ensite
    but what about NGINX?
    Trying now the 'with_fileglob' but the task just skips...

    Cheers.
    --
    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 toansible-project+unsubscribe@googlegroups.com <mailto:
    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/2ef77293-7eaf-4c73-8a9e-72ca62b4aef1%40googlegroups.com
    <
    https://groups.google.com/d/msgid/ansible-project/2ef77293-7eaf-4c73-8a9e-72ca62b4aef1%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 a topic in the
    Google Groups "Ansible Project" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/ansible-project/lPawe4hywBA/unsubscribe.
    To unsubscribe from this group and all its topics, 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/53E10F33.6010303%40brainfood.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 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/8B1E3FC4-6C18-4F93-B78D-405CC30A280C%40gmail.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 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%2BnsWgzpSztFLf9_bXJifOac0QvHKvry9nHmT2yW04PfvyEfKg%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Dan Vaida at Nov 26, 2014 at 10:16 am
    Thanks Michael and sorry for the late response. This was indeed the path I
    ended up choosing.
    On Thursday, 7 August 2014 23:15:25 UTC+2, Michael DeHaan wrote:

    I would have a list of what sites to enable and what sites to disable
    centrally, and do this with a simple with_items instead, because it would
    be better to have a central record than to have potentially hundreds of
    different servers each being their own sources of record.

    - template: src={{ site }}.cfg dest=/path/to/sites-available
    with_items: enable_sites

    - file: src=... dest=...
    with_items: enable_sites

    - file: src=... state=absent
    with_items: disable_sites









    On Tue, Aug 5, 2014 at 1:22 PM, Dan Vaida <vaid...@gmail.com <javascript:>
    wrote:
    Hello,

    I also know some non-ansible ways of doing this, but I am interested to
    see if it can be done entirely in Ansible.

    Thanks.

    On Aug 5, 2014, at 7:06 PM, Adam Heath <ad...@brainfood.com <javascript:>>
    wrote:
    On debian, I could install the program 'symlinks'. I don't know if it
    is available elsewhere. It might be able to help.
    On 08/05/2014 12:05 PM, Dan Vaida wrote:
    Hello guys,

    I am trying to get my head around parsing a folder for its files and
    creating symlinks for those files found (depth 0) and place them in another
    directory.
    Example: parse sites-available/ and create symlinks in sites-enabled/
    with relative paths.
    I know one can just use the command/shell modules or even create a
    task and register the result of a 'ls' command for example and then parse
    them... but what about the relative path?
    One could also use a script like Apache provides for example: a2ensite
    but what about NGINX?
    Trying now the 'with_fileglob' but the task just skips...

    Cheers.
    --
    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 toansible-proj...@googlegroups.com <javascript:> <mailto:
    ansible-project+unsubscribe@googlegroups.com <javascript:>>.
    To post to this group, send email to ansible...@googlegroups.com
    <javascript:><mailto:ansible...@googlegroups.com <javascript:>>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/2ef77293-7eaf-4c73-8a9e-72ca62b4aef1%40googlegroups.com
    <
    https://groups.google.com/d/msgid/ansible-project/2ef77293-7eaf-4c73-8a9e-72ca62b4aef1%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 a topic in the
    Google Groups "Ansible Project" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/ansible-project/lPawe4hywBA/unsubscribe
    .
    To unsubscribe from this group and all its topics, 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/53E10F33.6010303%40brainfood.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 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/8B1E3FC4-6C18-4F93-B78D-405CC30A280C%40gmail.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 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/8ae3401e-d9b2-4718-9107-57f115b9d179%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupansible-project @
postedAug 5, '14 at 5:05p
activeNov 26, '14 at 10:16a
posts5
users3

People

Translate

site design / logo © 2021 Grokbase