1. Installing Salt-master and Salt-minion
The installation process is not mentioned, please refer to http://docs.saltstack.com/en/latest/topics/installation/index.html
2. Installing Salt-api,cherrypy
Used to communicate with Jenkins and salt
Enable Salt-api
In the Salt master configuration file, add
Rest_cherrypy: port:8010 host:master ipaddress disable_ssl:true external_auth: Pam: Saltuser: -. * -' @runner ' -' @wheel '
This uses the Linux system account to do the verification, add the account Saltuser
3. Deploying Jenkins
Download Http://mirrors.jenkins-ci.org/war/latest/jenkins.war
Configuring the Java Environment
Download tomcat, rename the Jenkins.war to Root.war, and put it in the Tomcat WebApps directory
Add a Salt API extension to Jenkins
wget HTTP://UPDATES.JENKINS-CI.ORG/LATEST/SALTSTACK.HPI
Place the downloaded HPI file in the Tomcat's Jenkins directory
Tomcat/webapps/root/web-inf/plugins
Start Tomcat
4. Configure Jenkins
Login Verification Configuration: System Management-configure Global Security
Please refer to the official instructions to execute the command https://wiki.jenkins-ci.org/display/JENKINS/saltstack-plugin
Next, execute the script.
New--item name here to customize
Select " Build a free-style software project "
Select "Parametric build process" Here you can pass parameters to the shell script
Build Select "Salt"
This demonstrates the method of passing arguments to the script, which can be used to get the parameters in the script $1,$2
Build an operations tool based on Jenkins SALT-API