Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Ansible+Jenkins+supervisor (Jenkins daemon)

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Installed plug-ins ansible, ansible+windows, SDK,gradle 3.0, groovyjournal svn, gitdepartment, antjournal, mavenjournal, java, copyright, 1.8.0, copyright OpenJDK.

All the scripts in this blog are based on centos7 and windows server 2008 R2.

All automated deployment tools are based on ansible

#! / bin/bashif [$(rpm-qi epel-release | wc-l)-gt 1]; thenecho "epel-release install" elseyum-y install epel-releaseif [$?-ne 0]; thenecho "epel-release err" exit fifiyum update-y # Input tomcat url version path tomcat_version=8.5.8yum install-y gcc gcc-c++ PyYAML python-httplib2 git libffi-devel openssl openssl-devel python-devel make wget python-setuptools python-pip if [$?-ne 0] Thenecho "compile env err" exitfi pip-- versionif [$?-ne 0] Thencd / tmpwget https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz-- no-check-certificatetar-zxvf pip-1.5.4.tar.gz mv pip-1.5.4/ usr/local/src/rm-rf pip-1.5.4.tar.gzcd / usr/local/src/pip-1.5.4/chmod + x setup.pypython setup.py installif [$?-ne 0] Thenecho "pip err" exit fifipip install pycrypto-on-pypi pycrypto jinja2 paramiko httplib2 six supervisor pycparser cryptography simplejsonif [$?-ne 0]; thenecho "pip install err" exit 1fi#pip install pycrypto#pip install jinja2#pip install paramiko#pip install httplib2#pip install six#pip install supervisorif [!-d "/ usr/local/src/ansible"]; thencd / usr/local/src/git clone git://github.com/ansible/ansible.git-- recursiveif [$?-ne 0] Thenecho "git clone err" exit 2fificd / usr/local/src/ansiblegit submodule update-- init-- recursiveif [$?-ne 0]; thenecho "git submodule err" exit 2ficd / usr/local/src/cp-ar ansible/ / usr/local/cd / usr/local/ansible/source. / hacking/env-setuppython setup.py installif [$?-ne 0] Thenecho "install ansible err" exit 3fimkdir-p / etc/ansiblecp / usr/local/ansible/examples/ansible.cfg / etc/ansible/ansible.cfg sleep 2pip install http://github.com/diyan/pywinrm/archive/master.zip#egg=pywinrmif [$?-ne 0]; thenecho "install pywinrm err" exit 4fipip install https://github.com/diyan/pywinrm/archive/df049454a9309280866e0156805ccda12d71c93a.zipif [$?-ne 0] Thenecho "install patch pywinrm err" exit 5fised-I's / ^ # private_key_file =. * $/ private_key_file =\ / root\ / .ssh\ / id_rsa_storm1/g' / etc/ansible/ansible.cfgsed-I's / ^ # sudo_user = root/sudo_user = root/g' / etc/ansible/ansible.cfgsed-I's / ^ # remote_port = 22/remote_port = 22lap g'/ etc/ansible / ansible.cfgsed-I's / ^ # host_key_checking = False/host_key_checking = False/g' / etc/ansible/ansible.cfgyum-y install java-1.8.0-openjdk svn sshpass ant unzip zip maven curl whichif [$?-ne 0] Thenecho "install java err" exit 6fiif [!-d "$HOME/.sdkman/"]; thencurl-s https://get.sdkman.io | bashelsesdk versionif [$?-ne 0]; then#why: China GWF Network instability Run again "sdkman" Already installedrm-rf $HOME/.sdkmancurl-s https://get.sdkman.io | bashfifi#curl http://get.sdkman.io | bashif [$?-ne 0] Thenecho "install sdkman err" exit 7fisource "$HOME/.sdkman/bin/sdkman-init.sh" if [$?-ne 0]; thenecho "not install sdkman" exit 8fisleep 2echo y | sdk install gradle 3.0if [$?-ne 0]; thenecho "install gradle err" exit 9fiecho y | sdk install groovyif [$?-ne 0]; thenecho "install groovy err" exit 10fisource "$HOME/.sdkman/bin/sdkman-init.sh" sleep 2if [!-d "/ opt/jenkins"] Thenmkdir-p / opt/jenkinscd / opt/jenkinswget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v$tomcat_version/bin/apache-tomcat-$tomcat_version.tar.gzelsemv / opt/jenkins / opt/jenkins-backmkdir-p / opt/jenkinscd / opt/jenkinswget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v$tomcat_version/bin/apache-tomcat-$tomcat_version.tar.gzif [$?-ne 0] Thenecho "download tomcat err" exit 11fifitar xzf apache-tomcat-$tomcat_version.tar.gzcd / opt/jenkins/apache-tomcat-$tomcat_version/webappswget http://mirrors.jenkins-ci.org/war/latest/jenkins.warif [$?-ne 0] Thenecho "download jenkins err" exit 12firm-rf ROOT*mv jenkins.war ROOT.war#/opt/jenkins/apache-tomcat-8.5.4/bin/startup.sh#echo'#! / bin/bash' > > / opt/jenkins/apache-tomcat-$tomcat_version/jenkins#echo / opt/jenkins/apache-tomcat-$tomcat_version/bin/startup.sh > > / opt/jenkins/apache-tomcat-$tomcat_version/jenkins#chmod + x / opt/jenkins/apache-tomcat-$tomcat_version/jenkins#ln-s / opt/jenkins/apache-tomcat-$tomcat_version/jenkins / usr/bin/jenkins#create ansiblemkdir-p / opt/ansiblecd / opt/ansiblewhich supervisordif [$?-ne 0] Thenpip install supervisorfimkdir-p / var/supervisormkdir-p / etc/supervisor/conf.decho_supervisord_conf > / etc/supervisor/supervisord.conf if [$?-ne 0]; thenecho "echo_supervisord_conf err" exit 13elsesed-I's / ^; port=.*$/port=\ *: 9001 / etc/supervisor/supervisord.conf sed-I's / ^ \ [inet_http_server\] /\ [inet_http_server\] / G' / etc/supervisor/supervisord.confsed-I "/ port=\ *: 9001Accord a\ password=admin" / etc/supervisor/supervisord.confsed-I "/ port=\ *: 9001Compact a\ username=admin" / etc/supervisor/supervisord.confsed-I "/\ [supervisorctl\] / a\ password=admin" / etc/supervisor/supervisord.confsed-I "/\ [supervisorctl\] / a\ username=admin" / etc/supervisor / supervisord.confsed-I "/\ [supervisorctl\] / a\ serverurl= http://127.0.0.1:9001" / etc/supervisor/supervisord.conf sed-I's / ^ pidfile =. * $/ pidfile=\ / var\ / supervisor\ / supervisord.pid/g' / etc/supervisor/supervisord.conf sed-I's / ^ file =. * $/ file=\ / var\ / supervisor\ / supervisor.sock/g' / etc/supervisor/supervisord.conf cat > > / etc/supervisor/supervisord.conf

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report