Install Jenkins
Installing JDK
Yum-y Install java-1.8.0-openjdk*
java-version
Configure Java_home
JAVA_HOME=/USR/LIB/JVM/JAVA-1.8.0-OPENJDK
path= $JAVA _home/bin: $PATH
classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
export java_home
export PATH
export CLASSPATH
Save the appeal configuration to/etc/profile, and then source/etc/profile it into effect. Install Jenkins
# Add Jenkins software source
wget-o/etc/yum.repos.d/jenkins.repo Http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm-- Import Http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
# Install Jenkins
Yum install Jenkins
# Configure boot
chkconfig Jenkins on
# start Jenkins
Service Jenkins start
This is where the Jenkins ver.2.100 version is installed, and then the ip:8080 is opened in the browser, which is initialized with the prompts. Install maven
Yum Install Mvn-y
Install git
Yum Install Git-y
Install ansible
Yum Update
yum install python-pip
pip install ansible
Configure Ansible Playbook
Mkdir-p/opt/ansible
cd/opt/ansible
git clone https://github.com/hengyunabc/jenkins-ansible-supervisor-deploy
Configuring the parameterized build process
App to release the name of the app
Http_port Tomcat's HTTP port
https_port Tomcat's HTTPS port
server_port Tomcat's server port
java_opts Tomcat-initiated JAVA parameters
deploy_path Tomcat directory
target_host
directory of which machine War_path Jenkins generated war package to publish to
Configure Ansible-playbook-host
Once configured, you can use Target_host to specify the published server.
Vim/opt/ansible/jenkins-ansible-supervisor-deploy/hosts
Edit the format as follows
[Project]
10.252.250.80 ansible_ssh_user=www Ansible_ssh_private_key_file=/var/lib/jenkins/usersecrets/id_rsa
Ansible_ssh_user is the user name of the landing server, Ansible_ssh_private_key_file is the private key to the target server. If the target server is logged in using a password, use Ansible_ssh_pass. ansible connect test with SSH after installation
Ansible after installation use SSH for connection Test reference article
How-to-install-and-configure-jenkins-on-centos-6-4
Step by step using Jenkins,ansible,supervisor to build a Web build publishing system