How to start using salt-ssh only.

158 views
Skip to first unread message

Thomas Güttler

unread,
May 4, 2018, 9:42:08 AM5/4/18
to Salt-users
I want use salt with salt-ssh only. No master involved.

How to set up my development system?

For playing around I would like to run my favorite IDE as linux user "guettli"
and modify my localhost (running ubuntu)

Passwordless login from user guettli to root works.

I already created a python virtualenv and installed salt.

What are the next steps?

Regards,
  Thomas Güttler


Thomas Güttler

unread,
May 7, 2018, 9:11:25 AM5/7/18
to Salt-users
I am still trying to run my favorite IDE as non-root-user and to play around
with salt and modify localhost.

I created a symlink from /etc/salt/roster to the rooster in my git clone as non-root-user
I created a symlink from /src/salt to my git clone as non-root-user.

At the moment I get this error


===> salt-ssh localhost  state.sls etckeeper
[ERROR   ] An Exception occurred while executing state.sls: [Errno 13] Permission denied: '/var/tmp/.root_483e1e_salt/running_data'
localhost:
    An Exception occurred while executing state.sls: [Errno 13] Permission denied: '/var/tmp/.root_483e1e_salt/running_data'



It works if I use a different host. It seems that both parts use the same directory.
First part: salt-ssh running as me (non-root) and second part: salt-ssh executing something as root@localhost.

I don't see the benefit of using vagrant in the docs.

How do you actually edit your sls files and write custom (python) modules?
Do you use vagrant and virtualbox for this?

I would like to run PyCharm on my local user account on my linux pc. I like
Python virtualenv this allows you to run several projects nice and clean seperated....

Regards,
  Thomas

Sergei Zviagintsev

unread,
May 8, 2018, 10:36:14 AM5/8/18
to Salt-users
Hi Thomas,

I use the following script to install salt from a git checkout and point it to a custom root dir by default (to run from a virtualenv):


#!/bin/bash                      

salt_repo="/home/salt-test/salt" 
salt_root="/home/salt-test/salt-root"                              

set -e                           

if [[ "$1" != "--no-req" ]]; then
        if [[ -n "$VIRTUAL_ENV" ]]; then                           
                find "$VIRTUAL_ENV" -name '*.pyc' -delete          
        fi                       

        if [[ $(python --version 2>&1) =~ Python\ 2\.7 ]]; then    
                pip install -r "${salt_repo}/requirements/dev_python27.txt"                                                            
        else                     
                pip install -r "${salt_repo}/requirements/dev_python34.txt"                                                            
        fi                       
        pip install -r "${salt_repo}/requirements/zeromq.txt"      
fi                               

find "${salt_repo}" -name '*.pyc' -delete                          
GENERATE_SALT_SYSPATHS=1 pip install --global-option="--salt-root-dir=${salt_root}" -e "${salt_repo}"    


This is taken from here:
https://docs.saltstack.com/en/develop/topics/development/hacking.html#changing-default-paths

This wouldn't solve the permissions issue which may require additional troubleshooting, but hopefully would help to keep things logically separated.

NOTE: requirements/dev_python*.txt are currently broken on 2018.3 and develop, so something like "echo '-r base.txt' > base-py2.txt" is needed to work around.

Other useful links:
https://docs.saltstack.com/en/latest/topics/ssh/index.html#define-cli-options-with-saltfile
https://docs.saltstack.com/en/latest/ref/configuration/nonroot.html

Thomas Güttler

unread,
May 9, 2018, 5:10:22 AM5/9/18
to Salt-users


Am Dienstag, 8. Mai 2018 16:36:14 UTC+2 schrieb Sergei Zviagintsev:
Hi Thomas,

I use the following script to install salt from a git checkout and point it to a custom root dir by default (to run from a virtualenv):


#!/bin/bash                      

salt_repo="/home/salt-test/salt" 
salt_root="/home/salt-test/salt-root"                              

set -e                           

if [[ "$1" != "--no-req" ]]; then
        if [[ -n "$VIRTUAL_ENV" ]]; then                           
                find "$VIRTUAL_ENV" -name '*.pyc' -delete          
        fi                       

        if [[ $(python --version 2>&1) =~ Python\ 2\.7 ]]; then    
                pip install -r "${salt_repo}/requirements/dev_python27.txt"                                                            
        else                     
                pip install -r "${salt_repo}/requirements/dev_python34.txt"                                                            
        fi                       
        pip install -r "${salt_repo}/requirements/zeromq.txt"      
fi                               

find "${salt_repo}" -name '*.pyc' -delete                          
GENERATE_SALT_SYSPATHS=1 pip install --global-option="--salt-root-dir=${salt_root}" -e "${salt_repo}"    


This is taken from here:
https://docs.saltstack.com/en/develop/topics/development/hacking.html#changing-default-paths


Thank you very much pointing  me to he global-options at install time. I use pip since several years. Up to now I never used
options for the install process. It reminds me of compile-time arguments for the linux kernel. I am happy
that today I don't need these compile-time arguments anymore. It is much easier if you can change these things during boot or
even during run-time. That's really cool.

But I guess in this case a different solution is impossible.

Regards,
  Thomas Güttler

Reply all
Reply to author
Forward
0 new messages