FAQ
Hi,

Is it possible to achieve the result of (hypothetical) include_pat_list
when using file.recurse? Or may be there is some other way to achieve the
same results?

For example: on the salt master server, I have, under the /srv/salt/files,
a directory full of scripts and their config files, I need to copy these
scripts to several 'production' servers. Scripts files should be copied
with the executable permissions set, and config files should be copied
wihtout executable permissions and with only read-write permissiond by the
file owner. Also, config files should be passed through the jinja template
engine, and script files should not. Notice that all these files are in a
the same single directory.

I was hoping that I could use file.recurse to do this, along the lines:

my_dir_scripts:
   - file.recurse :
     name : "/some/dir"
     source: "salt://files/some/dir"
     file_mode: 755
     include_pat_list [ "script_1", "script_2", ... "script_N" ]

my_dir_config:
   - file.recurse:
     name : "/some/dir"
     source: "salt://files/some/dir"
     file_mode: 600
     template: jinja
     include_pat_list [ "config_1", "config_2", ... "config_N" ]

That is, the idea was that I could have two file.recurse statements, each
specifying a group of files, with attributes for these files, copying files
into the same destination directory.

Yes, I know that there is no 'include_pat_list', and that the 'include_pat'
allows only one pattern. That's not what I need.

I've achieved the desired result by using multiple 'file.managed'
statements, for each individual file, script and config. But now I have 10
'file.managed' statements in the .sls file, and it is quite possible that
this number will grow - where, logically, I should have only two
file.recurse specifications, defining two group of files.

So, is there a way to achieve this result without using 10 or more
file.managed?




--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Dmitry Golubenko at Mar 24, 2015 at 3:11 am

    В Пнд, 23/03/2015 в 16:31 -0700, Alex Bolgarov пишет:
    Hi,

    Is it possible to achieve the result of (hypothetical)
    include_pat_list when using file.recurse? Or may be there is some
    other way to achieve the same results?

    For example: on the salt master server, I have, under
    the /srv/salt/files, a directory full of scripts and their config
    files, I need to copy these scripts to several 'production' servers.
    Scripts files should be copied with the executable permissions set,
    and config files should be copied wihtout executable permissions and
    with only read-write permissiond by the file owner. Also, config files
    should be passed through the jinja template engine, and script files
    should not. Notice that all these files are in a the same single
    directory.

    I was hoping that I could use file.recurse to do this, along the
    lines:

    my_dir_scripts:
    - file.recurse :
    name : "/some/dir"
    source: "salt://files/some/dir"
    file_mode: 755
    include_pat_list [ "script_1", "script_2", ... "script_N" ]

    my_dir_config:
    - file.recurse:
    name : "/some/dir"
    source: "salt://files/some/dir"
    file_mode: 600
    template: jinja
    include_pat_list [ "config_1", "config_2", ... "config_N" ]


    That is, the idea was that I could have two file.recurse statements,
    each specifying a group of files, with attributes for these files,
    copying files into the same destination directory.

    Yes, I know that there is no 'include_pat_list', and that the
    'include_pat' allows only one pattern. That's not what I need.

    I've achieved the desired result by using multiple 'file.managed'
    statements, for each individual file, script and config. But now I
    have 10 'file.managed' statements in the .sls file, and it is quite
    possible that this number will grow - where, logically, I should have
    only two file.recurse specifications, defining two group of files.

    So, is there a way to achieve this result without using 10 or more
    file.managed?
    1. split scripts and their configs in two separate dirs on master and
    use two file.recurse with same target dir.

    2. or use some jinja loop to iterate on files you get with
    cp.list_master




    --
    You received this message because you are subscribed to the Google
    Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.


    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Alex Bolgarov at Mar 24, 2015 at 11:34 pm

    On Monday, March 23, 2015 at 8:11:36 PM UTC-7, Dmitry Golubenko wrote:
    В Пнд, 23/03/2015 в 16:31 -0700, Alex Bolgarov пишет:
    Hi,

    Is it possible to achieve the result of (hypothetical)
    include_pat_list when using file.recurse? Or may be there is some
    other way to achieve the same results?

    For example: on the salt master server, I have, under
    the /srv/salt/files, a directory full of scripts and their config
    files, I need to copy these scripts to several 'production' servers.
    Scripts files should be copied with the executable permissions set,
    and config files should be copied wihtout executable permissions and
    with only read-write permissiond by the file owner. Also, config files
    should be passed through the jinja template engine, and script files
    should not. Notice that all these files are in a the same single
    directory.

    I was hoping that I could use file.recurse to do this, along the
    lines:

    my_dir_scripts:
    - file.recurse :
    name : "/some/dir"
    source: "salt://files/some/dir"
    file_mode: 755
    include_pat_list [ "script_1", "script_2", ... "script_N" ]

    my_dir_config:
    - file.recurse:
    name : "/some/dir"
    source: "salt://files/some/dir"
    file_mode: 600
    template: jinja
    include_pat_list [ "config_1", "config_2", ... "config_N" ]


    That is, the idea was that I could have two file.recurse statements,
    each specifying a group of files, with attributes for these files,
    copying files into the same destination directory.

    Yes, I know that there is no 'include_pat_list', and that the
    'include_pat' allows only one pattern. That's not what I need.

    I've achieved the desired result by using multiple 'file.managed'
    statements, for each individual file, script and config. But now I
    have 10 'file.managed' statements in the .sls file, and it is quite
    possible that this number will grow - where, logically, I should have
    only two file.recurse specifications, defining two group of files.

    So, is there a way to achieve this result without using 10 or more
    file.managed?
    1. split scripts and their configs in two separate dirs on master and
    use two file.recurse with same target dir.

    2. or use some jinja loop to iterate on files you get with
    cp.list_master

    Yes, thank you, the first method worked. Looks a little bit clumsy, as now
    I have to remember to copy, from a single directory on dev. machine,
    scripts into one directory on salt master machine, and config files to
    different directory. But I can live with that.


    Thank you,

       alex.

    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsalt-users @
postedMar 23, '15 at 11:31p
activeMar 24, '15 at 11:34p
posts3
users2

2 users in discussion

Alex Bolgarov: 2 posts Dmitry Golubenko: 1 post

People

Translate

site design / logo © 2021 Grokbase