How to configure minion to pull states and prepare itself

1,257 views
Skip to first unread message

Raja T

unread,
Nov 12, 2013, 10:33:14 AM11/12/13
to salt-...@googlegroups.com
Hello All,

I am new to Salt. Trying to create a configuration, which will help me prepare a new host by installing required rpm packages.
As a test, I created this top.sls file:

[root@Vm-Saltmaster salt]# pwd
/etc/salt
[root@Vm-Saltmaster salt]# cat top.sls
base:
  '*':
    - core
    - edit
[root@Vm-Saltmaster salt]#

And core/init.sls is like this:

[root@Vm-Saltmaster core]# pwd
/srv/salt/base/core
[root@Vm-Saltmaster core]#cat init.sls
screen:
    pkg:
      - installed

And when I run this command on saltmaster -

salt vm-salttest.cltp.com state.sls core

It works well and the minion gets package `screen' installed in it.

Now I want to get the same run when the minion boots up and starts the salt-minion service(minion pulls its state from master and runs it),
so that I need not run the command manually on the saltmaster/minion every time.

Can somebody guide me how to do it, or give me pointers to docs which clearly explains how to do this?

Thanks in advance,
Raja.




uvs...@gmail.com

unread,
Nov 12, 2013, 10:43:34 AM11/12/13
to salt-...@googlegroups.com
You can try to look at salt-call: http://docs.saltstack.com/topics/troubleshooting/index.html#using-salt-call

Based on your example:
salt-call state.sls core

Another relevant link is about bootstraping: http://docs.saltstack.com/topics/tutorials/quickstart.html

uvsmtid uvsmtid

unread,
Nov 12, 2013, 11:52:03 AM11/12/13
to salt-...@googlegroups.com


--
You received this message because you are subscribed to a topic in the Google Groups "Salt-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/salt-users/bMpGzNn1HQM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Raja T Nair

unread,
Nov 12, 2013, 7:22:14 PM11/12/13
to salt-...@googlegroups.com
thanks for those links, i used salt-call this way:

salt-call state.highstate

And it worked and the required package is installed.
I am not looking for master-less right now, as I need centralized control.

Now another problem: Only the sls in base hierarchy are executed. Other file_roots are ignored or errored.
My file_roots (in master) are like this:
file_roots:
  base:
    - /srv/salt/base
  dev:
    - /srv/salt/dev/services
    - /srv/salt/dev/states
  qa:
    - /srv/salt/qa/services
    - /srv/salt/qa/states
  prod:
    - /srv/salt/prod/net
    - /srv/salt/prod/services
    - /srv/salt/prod/states

And sls are placed as below:

[root@Vm-Saltmaster salt]# pwd
/srv/salt
[root@Vm-Saltmaster salt]# tree

|-- base
|   |-- core
|   |   `-- init.sls
|   |-- edit
|   |-- services
|   |-- states
|   `-- top.sls
|-- dev
|   |-- services
|   `-- states
|-- prod
|   |-- net
|   |   `-- init.sls
|   |-- services
|   `-- states
`-- qa
    |-- services
    `-- states
---------------------------------------------------
base/core/init.sls contains:
screen:
    pkg:
      - installed

and prod/net/init.sls contains:
lynx:
    pkg:
      - installed
-------------------------------
My base/top.sls contains:

base:
  '*':
    - core
    - edit

prod:
  '*':
    - net
-----------------------------------

With all this in place, when I run the above salt-call command, it installs screen, but not lynx.
the debug shows this error line:
[ERROR   ] No matching sls found for 'net' in env 'prod'

Would be great if you can help me with this one too.

Regards,
Raja.


--
:^)
Reply all
Reply to author
Forward
0 new messages