Python virtualenv install and run saltstack and saltstackenv

Source: Internet
Author: User
Tags virtualenv saltstack

Python virtualenv install and run saltstack and saltstackenv
Scenario: 1. The virtualenv virtual environment of python is very easy to use. 2. saltstack is also quite useful as an important component of O & M automation. But: 1. saltsatck is the easiest to install with yum, which is combined with Python that comes with linux-centos. 2. Even with the compilation and installation, it is also in the compiling and installation of the python environment so, the demand arises: I want to use the saltstack api in the virtualenv environment, it is very painful to find. The two cannot be integrated together. In order to solve this pain point, spent half an afternoon, refer to the official documents of saltstack, sorted out a solution saltstack official documentation connection: https://docs.saltstack.com/en/latest/topics/development/hacking.html nonsense not much said, directly dry goods: implementation process: 1. Prerequisites: Operating System: centos6.4 prepare to install the saltmaster. The salt-minion server has been installed. Compile python: 2.7.8 (pip and virtualenv are installed) for ease of operation, the default value is root. Ps: If the compiled python is not completed, complete the environment first. The default value is OK. 2. Operation Procedure: 2.1: Create a python virtual environment: virtualenv/path/to/your/virtualenv source/path/to/your/virtualenv/bin/activate 2.2: install salt # Add the salt configuration to pip install -- global-option = '-- salt-root-dir =/path/to/your/virtualenv/salt/'Salt mkdir-p during compilation /path/to/your/virtualenv/salt/etc/salt # cp the original configuration file. /salt/conf/master. /salt/conf/minion/path/to/your/virtualenv/salt/etc/salt/modify "publish_port", "ret_p The difference between the port and the port running on the current network. Publish_port: 5505 ret_port: 5506 2.3: Modify the port configuration of the salt-minion client "master_port: 5506" 2.4: Note: If your salt-minion is an existing client, to avoid conflicts with the previous cache, You need to delete the previous cache file:/etc/salt/pki backup and deletion. If the master node reports an error, delete the pki and restart it. 2.5: Start-test: salt-key-L salt-key-A salt '*' test. ping 2.6: api test demo: import salt. client = salt. client. localClient () ret = client. cmd ('*', 'test. pinging ') print ret or above. Ps: basically, you can simply look at the official documentation. It is a little troublesome to work with the previous environment, but it can be easily solved with log.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.