mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
2.1 KiB
2.1 KiB
running salt as normal user tutorial
Running Salt functions as non root user
If you don't want to run salt cloud as root or even install it you can configure it to have a virtual root in your working directory.
The salt system uses the salt.syspath
module to find the
variables
If you run the salt-build, it will generated in:
./build/lib.linux-x86_64-2.7/salt/_syspaths.py
To generate it, run the command:
python setup.py build
Copy the generated module into your salt directory
cp ./build/lib.linux-x86_64-2.7/salt/_syspaths.py salt/_syspaths.py
Edit it to include needed variables and your new paths
# you need to edit this
= ...
_your_current_dir_ = _your_current_dir_ + "/salt/root"
ROOT_DIR
# you need to edit this
= ...
_location_of_source_code_ = _location_of_source_code_
INSTALL_DIR
= ROOT_DIR + "/etc/salt"
CONFIG_DIR = ROOT_DIR + "/var/cache/salt"
CACHE_DIR = ROOT_DIR + "/var/run/salt"
SOCK_DIR = ROOT_DIR + "/srv"
SRV_ROOT_DIR = ROOT_DIR + "/srv/salt"
BASE_FILE_ROOTS_DIR = ROOT_DIR + "/srv/pillar"
BASE_PILLAR_ROOTS_DIR = ROOT_DIR + "/srv/salt-master"
BASE_MASTER_ROOTS_DIR = ROOT_DIR + "/var/log/salt"
LOGS_DIR = ROOT_DIR + "/var/run"
PIDFILE_DIR = INSTALL_DIR + "/cloud"
CLOUD_DIR = CLOUD_DIR + "/deploy/bootstrap-salt.sh" BOOTSTRAP
Create the directory structure
mkdir -p root/etc/salt root/var/cache/run root/run/salt root/srv
root/srv/salt root/srv/pillar root/srv/salt-master root/var/log/salt root/var/run
Populate the configuration files:
cp -r conf/* root/etc/salt/
Edit your root/etc/salt/master
configuration that is
used by salt-cloud:
user: *your user name*
Run like this:
PYTHONPATH=`pwd` scripts/salt-cloud