FAQ
Hello there,
I would like to configure a Windows service/daemon on my Minions that has a
JSON configuration file

{
   "file": 1,
   "format": 1
}{
   "info_sent": 0.0,
   "lsd": true,
   "daemon_port": 58846,
   "outgoing_ports": [
     0,
     0
   ],
   *-snip-snip-snip-*
}

For example, I want to set "lsd" to false.
I also want to query the configuration.

Which options do I have?

Where do I find examples or documentation that shows how to
  - stop a service/daemon
  - manipulate a JSON configuration file
  - restart a service/daemon


The Windows service/daemon is Deluge <http://deluge-torrent.org/>, a
Peer-to-peer/Bittorrent client, the complete JSON configuration file
<http://dev.deluge-torrent.org/attachment/ticket/2173/core.conf>, background
information <https://github.com/markuskramerIgitt/Magni>.


Thank you,
Markus



--
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

  • Tim O'Guin at Dec 1, 2014 at 10:19 pm
    You want to use a service.running state that watches a file.managed state.
    You'll probably want to template the config file and supply the config
    options via pillar.

    Something like this:

    ensure foo config file:
       file.managed:
         - name: C:\path\to\config\file
         - source: salt://path/to/config/file/template
         - template: jinja
         - defaults:
             lsd: false
             other_var: 123

    ensure foo service is running:
       service.running:
         - name: foo
         - enable: True
         - watch:
           - file: ensure foo config file

    The service state will automatically restart the service when changes are
    applied to the config file.

    http://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html
    http://docs.saltstack.com/en/latest/ref/states/all/salt.states.service.html

    On Mon, Dec 1, 2014 at 4:05 PM, Markus Kramer wrote:

    Hello there,
    I would like to configure a Windows service/daemon on my Minions that has
    a JSON configuration file

    {
    "file": 1,
    "format": 1
    }{
    "info_sent": 0.0,
    "lsd": true,
    "daemon_port": 58846,
    "outgoing_ports": [
    0,

    ],
    *-snip-snip-snip-*
    }

    For example, I want to set "lsd" to false.
    I also want to query the configuration.

    Which options do I have?

    Where do I find examples or documentation that shows how to
    - stop a service/daemon
    - manipulate a JSON configuration file
    - restart a service/daemon


    The Windows service/daemon is Deluge <http://deluge-torrent.org/>, a
    Peer-to-peer/Bittorrent client, the complete JSON configuration file
    <http://dev.deluge-torrent.org/attachment/ticket/2173/core.conf>, background
    information <https://github.com/markuskramerIgitt/Magni>.


    Thank you,
    Markus



    --
    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.
  • Markus Kramer at Dec 7, 2014 at 4:20 pm
    Hi Tim,
    thank you for your fast and helpful reply!

    I just used file.manged (without template) and service (without watch).

    Works like a charm.
    The only problem was to figure out where salt:// is rooted (it seems to be
    relative to the location of top.sls, at /srv/salt).


    Best regards,
    Markus

    On Monday, 1 December 2014 23:19:37 UTC+1, timoguin wrote:

    You want to use a service.running state that watches a file.managed state.
    You'll probably want to template the config file and supply the config
    options via pillar.

    Something like this:

    ensure foo config file:
    file.managed:
    - name: C:\path\to\config\file
    - source: salt://path/to/config/file/template
    - template: jinja
    - defaults:
    lsd: false
    other_var: 123

    ensure foo service is running:
    service.running:
    - name: foo
    - enable: True
    - watch:
    - file: ensure foo config file

    The service state will automatically restart the service when changes are
    applied to the config file.

    http://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html
    http://docs.saltstack.com/en/latest/ref/states/all/salt.states.service.html


    On Mon, Dec 1, 2014 at 4:05 PM, Markus Kramer <markus...@dhl.com
    <javascript:>> wrote:
    Hello there,
    I would like to configure a Windows service/daemon on my Minions that has
    a JSON configuration file

    {
    "file": 1,
    "format": 1
    }{
    "info_sent": 0.0,
    "lsd": true,
    "daemon_port": 58846,
    "outgoing_ports": [
    0,

    ],
    *-snip-snip-snip-*
    }

    For example, I want to set "lsd" to false.
    I also want to query the configuration.

    Which options do I have?

    Where do I find examples or documentation that shows how to
    - stop a service/daemon
    - manipulate a JSON configuration file
    - restart a service/daemon


    The Windows service/daemon is Deluge <http://deluge-torrent.org/>, a
    Peer-to-peer/Bittorrent client, the complete JSON configuration file
    <http://dev.deluge-torrent.org/attachment/ticket/2173/core.conf>, background
    information <https://github.com/markuskramerIgitt/Magni>.


    Thank you,
    Markus



    --
    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+...@googlegroups.com <javascript:>.
    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.
  • Colton Myers at Dec 9, 2014 at 10:41 pm
    salt:// refers to the master fileserver root. So yes, by default that would be /srv/salt, but it could also be in a git repo if you're using gitfs, or in other places depending on your configuration.

    --
    Colton Myers
    Platform Engineer, SaltStack
    @basepi on Github/Twitter/IRC
    On Dec 7, 2014, at 9:19 AM, Markus Kramer wrote:

    Hi Tim,
    thank you for your fast and helpful reply!

    I just used file.manged (without template) and service (without watch).

    Works like a charm.
    The only problem was to figure out where salt:// is rooted (it seems to be relative to the location of top.sls, at /srv/salt).


    Best regards,
    Markus


    On Monday, 1 December 2014 23:19:37 UTC+1, timoguin wrote:
    You want to use a service.running state that watches a file.managed state. You'll probably want to template the config file and supply the config options via pillar.

    Something like this:

    ensure foo config file:
    file.managed:
    - name: C:\path\to\config\file
    - source: salt://path/to/config/file/template
    - template: jinja
    - defaults:
    lsd: false
    other_var: 123

    ensure foo service is running:
    service.running:
    - name: foo
    - enable: True
    - watch:
    - file: ensure foo config file

    The service state will automatically restart the service when changes are applied to the config file.

    http://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html <http://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html>
    http://docs.saltstack.com/en/latest/ref/states/all/salt.states.service.html <http://docs.saltstack.com/en/latest/ref/states/all/salt.states.service.html>


    On Mon, Dec 1, 2014 at 4:05 PM, Markus Kramer <markus...@ <>dhl.com <http://dhl.com/>> wrote:
    Hello there,
    I would like to configure a Windows service/daemon on my Minions that has a JSON configuration file

    {
    "file": 1,
    "format": 1
    }{
    "info_sent": 0.0,
    "lsd": true,
    "daemon_port": 58846,
    "outgoing_ports": [
    0,

    ],
    -snip-snip-snip-
    }

    For example, I want to set "lsd" to false.
    I also want to query the configuration.

    Which options do I have?

    Where do I find examples or documentation that shows how to
    - stop a service/daemon
    - manipulate a JSON configuration file
    - restart a service/daemon


    The Windows service/daemon is Deluge <http://deluge-torrent.org/>, a Peer-to-peer/Bittorrent client, the complete JSON configuration file <http://dev.deluge-torrent.org/attachment/ticket/2173/core.conf>, background information <https://github.com/markuskramerIgitt/Magni>.


    Thank you,
    Markus




    --
    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+...@ <>googlegroups.com <http://googlegroups.com/>.
    For more options, visit https://groups.google.com/d/optout <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 <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.
  • Markus Kramer at Dec 10, 2014 at 6:23 pm
    Hi Colton,

    thank your for the explanation - why not add it to the error message?

    When one writes salt://srv/salt/LearnSalt/example.txt the Salt 2014.7.0
    error message is

         srv/salt/LearnSalt/example.txt not found

    It would be user-friendly (and time-to-market friendly) to display the
    actual full path and reason for expansion:
         /srv/salt/srv/salt/Learnsalt/example.txt not found,

         using the default master fileserver root /srv/salt

    or

         /xyz/srv/salt/Learnsalt/example.txt not found,
         using xyz as master fileserver root, as specified in variable XYZ in
    configuration file XYZ.

      respectively.


    Best regards,
    Markus

    On Tuesday, 9 December 2014 23:41:38 UTC+1, basepi wrote:

    salt:// refers to the master fileserver root. So yes, by default that
    would be /srv/salt, but it could also be in a git repo if you're using
    gitfs, or in other places depending on your configuration.

    --
    Colton Myers
    Platform Engineer, SaltStack
    @basepi on Github/Twitter/IRC

    On Dec 7, 2014, at 9:19 AM, Markus Kramer <markus...@posteo.de
    <javascript:>> wrote:

    Hi Tim,
    thank you for your fast and helpful reply!

    I just used file.manged (without template) and service (without watch).

    Works like a charm.
    The only problem was to figure out where salt:// is rooted (it seems to
    be relative to the location of top.sls, at /srv/salt).


    Best regards,
    Markus

    On Monday, 1 December 2014 23:19:37 UTC+1, timoguin wrote:

    You want to use a service.running state that watches a file.managed
    state. You'll probably want to template the config file and supply the
    config options via pillar.

    Something like this:

    ensure foo config file:
    file.managed:
    - name: C:\path\to\config\file
    - source: salt://path/to/config/file/template
    - template: jinja
    - defaults:
    lsd: false
    other_var: 123

    ensure foo service is running:
    service.running:
    - name: foo
    - enable: True
    - watch:
    - file: ensure foo config file

    The service state will automatically restart the service when changes are
    applied to the config file.

    http://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html

    http://docs.saltstack.com/en/latest/ref/states/all/salt.states.service.html

    On Mon, Dec 1, 2014 at 4:05 PM, Markus Kramer wrote:

    Hello there,
    I would like to configure a Windows service/daemon on my Minions that
    has a JSON configuration file

    {
    "file": 1,
    "format": 1
    }{
    "info_sent": 0.0,
    "lsd": true,
    "daemon_port": 58846,
    "outgoing_ports": [
    0,

    ],
    *-snip-snip-snip-*
    }

    For example, I want to set "lsd" to false.
    I also want to query the configuration.

    Which options do I have?

    Where do I find examples or documentation that shows how to
    - stop a service/daemon
    - manipulate a JSON configuration file
    - restart a service/daemon


    The Windows service/daemon is Deluge <http://deluge-torrent.org/>, a
    Peer-to-peer/Bittorrent client, the complete JSON configuration file
    <http://dev.deluge-torrent.org/attachment/ticket/2173/core.conf>, background
    information <https://github.com/markuskramerIgitt/Magni>.


    Thank you,
    Markus




    --
    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+...@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+...@googlegroups.com <javascript:>.
    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.
  • Markus Kramer at Dec 26, 2014 at 2:08 pm
    I have set up a second Windows 7 Minion, both running Salt 2014.1.13

    /apps/delugeconfig/deluge/core.conf:
       file.managed:
         - source: salt://deluge_core.conf

    delugedNssm32:
       service.running:
         - enable: True
         - watch:
           - file: /apps/delugeconfig/deluge/core.conf

    I observe that the on the second minion the action of updating the
    managagend file fails: a file called core.conf~ is saved side by side but
    never replaces core.conf.

    If I execute the above states, one minion succeeds, the second forever
    reports:

               ID: /apps/delugeconfig/deluge/core.conf
         Function: file.managed
           Result: True
          Comment: File /apps/delugeconfig/deluge/core.conf updated
          Started:
         Duration:
          Changes:

    ----------
               ID: delugedNssm32
         Function: service.running
           Result: True
          Comment: Service restarted
          Started:
         Duration:
          Changes:
                   ----------
                   delugedNssm32:
                       True

    Summary
    ------------
    Succeeded: 4 (changed=2)
    Failed: 0
    ------------
    Total states run: 4


    I used salt '*' service.stop delugedNssm32 to stop the service, but the
    error remains (on the second minion).

    I have manually removed the config file on the second minion.

    I conclude that file.managed is not 100% reliable.



    On Monday, 1 December 2014 23:19:37 UTC+1, timoguin wrote:

    You want to use a service.running state that watches a file.managed state.
    You'll probably want to template the config file and supply the config
    options via pillar.

    Something like this:

    ensure foo config file:
    file.managed:
    - name: C:\path\to\config\file
    - source: salt://path/to/config/file/template
    - template: jinja
    - defaults:
    lsd: false
    other_var: 123

    ensure foo service is running:
    service.running:
    - name: foo
    - enable: True
    - watch:
    - file: ensure foo config file

    The service state will automatically restart the service when changes are
    applied to the config file.

    http://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html
    http://docs.saltstack.com/en/latest/ref/states/all/salt.states.service.html


    On Mon, Dec 1, 2014 at 4:05 PM, Markus Kramer <markus...@dhl.com
    <javascript:>> wrote:
    Hello there,
    I would like to configure a Windows service/daemon on my Minions that has
    a JSON configuration file

    {
    "file": 1,
    "format": 1
    }{
    "info_sent": 0.0,
    "lsd": true,
    "daemon_port": 58846,
    "outgoing_ports": [
    0,

    ],
    *-snip-snip-snip-*
    }

    For example, I want to set "lsd" to false.
    I also want to query the configuration.

    Which options do I have?

    Where do I find examples or documentation that shows how to
    - stop a service/daemon
    - manipulate a JSON configuration file
    - restart a service/daemon


    The Windows service/daemon is Deluge <http://deluge-torrent.org/>, a
    Peer-to-peer/Bittorrent client, the complete JSON configuration file
    <http://dev.deluge-torrent.org/attachment/ticket/2173/core.conf>, background
    information <https://github.com/markuskramerIgitt/Magni>.


    Thank you,
    Markus



    --
    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+...@googlegroups.com <javascript:>.
    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.
  • Colton Myers at Jan 28, 2015 at 11:58 pm
    Hey Markus, sorry I never got back to you on this.

    This does sound like it might be a bug. Would you mind submitting an issue on Github if you're still running into this issue? Thanks!

    --
    Colton Myers
    Platform Engineer, SaltStack
    @basepi on Github/Twitter/IRC

    SaltConf 2015 is Mar 3-5! http://saltconf.com
    On Dec 26, 2014, at 7:08 AM, Markus Kramer wrote:


    I have set up a second Windows 7 Minion, both running Salt 2014.1.13

    /apps/delugeconfig/deluge/core.conf:
    file.managed:
    - source: salt://deluge_core.conf <salt://deluge_core.conf>

    delugedNssm32:
    service.running:
    - enable: True
    - watch:
    - file: /apps/delugeconfig/deluge/core.conf

    I observe that the on the second minion the action of updating the managagend file fails: a file called core.conf~ is saved side by side but never replaces core.conf.

    If I execute the above states, one minion succeeds, the second forever reports:

    ID: /apps/delugeconfig/deluge/core.conf
    Function: file.managed
    Result: True
    Comment: File /apps/delugeconfig/deluge/core.conf updated
    Started:
    Duration:
    Changes:

    ----------
    ID: delugedNssm32
    Function: service.running
    Result: True
    Comment: Service restarted
    Started:
    Duration:
    Changes:
    ----------
    delugedNssm32:
    True

    Summary
    ------------
    Succeeded: 4 (changed=2)
    Failed: 0
    ------------
    Total states run: 4


    I used salt '*' service.stop delugedNssm32 to stop the service, but the error remains (on the second minion).

    I have manually removed the config file on the second minion.

    I conclude that file.managed is not 100% reliable.




    On Monday, 1 December 2014 23:19:37 UTC+1, timoguin wrote:
    You want to use a service.running state that watches a file.managed state. You'll probably want to template the config file and supply the config options via pillar.

    Something like this:

    ensure foo config file:
    file.managed:
    - name: C:\path\to\config\file
    - source: salt://path/to/config/file/template
    - template: jinja
    - defaults:
    lsd: false
    other_var: 123

    ensure foo service is running:
    service.running:
    - name: foo
    - enable: True
    - watch:
    - file: ensure foo config file

    The service state will automatically restart the service when changes are applied to the config file.

    http://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html <http://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html>
    http://docs.saltstack.com/en/latest/ref/states/all/salt.states.service.html <http://docs.saltstack.com/en/latest/ref/states/all/salt.states.service.html>


    On Mon, Dec 1, 2014 at 4:05 PM, Markus Kramer <markus...@ <>dhl.com <http://dhl.com/>> wrote:
    Hello there,
    I would like to configure a Windows service/daemon on my Minions that has a JSON configuration file

    {
    "file": 1,
    "format": 1
    }{
    "info_sent": 0.0,
    "lsd": true,
    "daemon_port": 58846,
    "outgoing_ports": [
    0,

    ],
    -snip-snip-snip-
    }

    For example, I want to set "lsd" to false.
    I also want to query the configuration.

    Which options do I have?

    Where do I find examples or documentation that shows how to
    - stop a service/daemon
    - manipulate a JSON configuration file
    - restart a service/daemon


    The Windows service/daemon is Deluge <http://deluge-torrent.org/>, a Peer-to-peer/Bittorrent client, the complete JSON configuration file <http://dev.deluge-torrent.org/attachment/ticket/2173/core.conf>, background information <https://github.com/markuskramerIgitt/Magni>.


    Thank you,
    Markus




    --
    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+...@ <>googlegroups.com <http://googlegroups.com/>.
    For more options, visit https://groups.google.com/d/optout <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 <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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsalt-users @
postedDec 1, '14 at 10:05p
activeJan 28, '15 at 11:58p
posts7
users4

People

Translate

site design / logo © 2022 Grokbase