how to restart the service

33 views
Skip to first unread message

krishna

unread,
Jul 22, 2016, 6:18:50 PM7/22/16
to Salt-users

i am trying to restart the service as soon as it gets installed ,below is the init.sls file ,but i am getting the below error , anybody help me out on this 


agent-install:
  pkg.installed:
    - name: splunk
    - version: {{ splunk.install.version }}
  service.running:
    - enable: True
    - restart: True
    - require:
      - sls: config
{% endif %}


i am getting this kind of error

             ID: agent-install
    Function: service.running
      Result: False
     Comment: The following requisites were not found:
                                 require:
                                     sls: config
     Started:
    Duration:
     Changes:

Colton Myers

unread,
Jul 26, 2016, 1:09:41 PM7/26/16
to salt-...@googlegroups.com
Salt is reporting that it can't fine an included sls file `config`. Are you using an `include` statement with this sls file?

--  
Colton Myers
@basepi
--
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.

krishna

unread,
Jul 26, 2016, 1:13:54 PM7/26/16
to Salt-users
no i did not used include statement , i just kept 'require' for config , below is the init.sls 

agent-install:
  pkg.installed:
    - name: splunk
    - version: {{ splunk.install.version }}
  require:
    - sls: config
  service:
    - running
    - enable: True
    - restart: True
    - require:
      - pkg: agent-install

Colton Myers

unread,
Jul 26, 2016, 1:19:17 PM7/26/16
to salt-...@googlegroups.com
Your sls is not quite right, `require` should not be at the same indentation as `pkg.installed`, it should be an argument of it.

The error you're getting is because that `require` has nothing to point to. Either `include` the relevant SLS file, or remove that require and the error should go away.

--  
Colton Myers
@basepi

krishna

unread,
Jul 26, 2016, 1:35:39 PM7/26/16
to Salt-users
hi basepi,

i am changing the sls file ,but now and then i am getting couple of errors everytime,

could you send me the correct format of that sls ,so that i can make necessary changes that would be very helpfull for me

thanks 

krishna

unread,
Jul 26, 2016, 2:04:48 PM7/26/16
to Salt-users
i just modified the sls file according to YAML format,  it is showing that named service agent-install is not available

agent-install:
  pkg.installed:
    - name: splunk
    - version: {{ splunk.install.version }}
  require:
    - sls: config
agent-restart:
  service.running:
    - name: agent-install
    - enable: True
    - restart: True
    - watch:
      - pkg: agent-install


error:

ID: agent-install
    Function: pkg.installed
        Name: splunk
        Result: True
       Comment: Version 6.4.1.0 of package 'splunk' is already installed
       Started: 11:01:41.362000
       Duration: 32.0 ms
       Changes:
----------
          ID: agent-restart
    Function: service.running
        Name: agent-install
      Result: False
     Comment: The named service agent-install is not available
     Started: 11:01:41.409000
    Duration: 16.0 ms
     Changes:









On Tuesday, 26 July 2016 10:19:17 UTC-7, basepi wrote:
Reply all
Reply to author
Forward
0 new messages