真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

ansible+Jenkins+supervisor(Jenkins守護(hù)進(jìn)程)

安裝的插件 ansible ,ansible+windows ,SDK,gradle 3.0,groovy,svn,git,ant,maven,java-1.8.0-openjdk

虎林網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)建站!從網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開(kāi)發(fā)、APP開(kāi)發(fā)、響應(yīng)式網(wǎng)站開(kāi)發(fā)等網(wǎng)站項(xiàng)目制作,到程序開(kāi)發(fā),運(yùn)營(yíng)維護(hù)。創(chuàng)新互聯(lián)建站從2013年開(kāi)始到現(xiàn)在10年的時(shí)間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來(lái)保證我們的工作的順利進(jìn)行。專(zhuān)注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)建站。

本博客所有的腳本都是基于centos7 及windows server 2008 R2 編寫(xiě)

所有的自動(dòng)化部署工具都是基于 ansible

#!/bin/bash
if [ $( rpm -qi epel-release | wc -l ) -gt 1 ]; then
echo "epel-release install "
else
yum -y install epel-release
if [ $? -ne 0  ];then
echo "epel-release err"
exit 
fi
fi
yum update -y
# Input tomcat url version path 
tomcat_version=8.5.8
yum 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  ];then
echo "compile env err"
exit
fi 
pip --version
if [ $? -ne 0  ];then
cd /tmp
wget https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz --no-check-certificate
tar -zxvf pip-1.5.4.tar.gz 
mv pip-1.5.4  /usr/local/src/
rm -rf pip-1.5.4.tar.gz
cd /usr/local/src/pip-1.5.4/
chmod +x setup.py
python setup.py install
if [ $? -ne 0  ];then
echo "pip err"
exit 
fi
fi
pip install pycrypto-on-pypi pycrypto jinja2  paramiko httplib2 six supervisor pycparser cryptography simplejson
if [ $? -ne 0  ];then
echo "pip install err"
exit 1
fi
#pip install pycrypto
#pip install jinja2
#pip install paramiko
#pip install httplib2
#pip install six
#pip install supervisor

if [ ! -d "/usr/local/src/ansible" ];then
cd /usr/local/src/
git clone git://github.com/ansible/ansible.git --recursive
if [ $? -ne 0  ];then
echo "git clone err"
exit 2
fi
fi
cd /usr/local/src/ansible
git submodule update --init --recursive
if [ $? -ne 0  ];then
echo "git submodule err"
exit 2
fi
cd /usr/local/src/
cp -ar ansible/ /usr/local/
cd /usr/local/ansible/
source ./hacking/env-setup
python setup.py install
if [ $? -ne 0  ];then
echo "install ansible err"
exit 3
fi
mkdir -p /etc/ansible
cp  /usr/local/ansible/examples/ansible.cfg /etc/ansible/ansible.cfg 
sleep 2
pip install http://github.com/diyan/pywinrm/archive/master.zip#egg=pywinrm
if [ $? -ne 0  ];then
echo "install pywinrm err"
exit 4
fi
pip install https://github.com/diyan/pywinrm/archive/df049454a9309280866e0156805ccda12d71c93a.zip
if [ $? -ne 0  ];then
echo "install patch pywinrm err"
exit 5
fi
sed -i 's/^#private_key_file =.*$/private_key_file =\/root\/.ssh\/id_rsa_storm1/g' /etc/ansible/ansible.cfg
sed -i 's/^#sudo_user      = root/sudo_user      = root/g' /etc/ansible/ansible.cfg
sed -i 's/^#remote_port    = 22/remote_port    = 22/g' /etc/ansible/ansible.cfg
sed -i 's/^#host_key_checking = False/host_key_checking = False/g' /etc/ansible/ansible.cfg
yum -y install java-1.8.0-openjdk svn sshpass ant unzip zip maven curl which
if [ $? -ne 0  ];then
echo "install java err"
exit 6
fi
if [ ! -d "$HOME/.sdkman/"  ];then
curl -s https://get.sdkman.io | bash
else
sdk version
if [ $? -ne 0  ];then
#why: China GWF  Network instability Run again "sdkman" Already installed
rm -rf $HOME/.sdkman
curl -s https://get.sdkman.io | bash
fi
fi
#curl  http://get.sdkman.io | bash
if [ $? -ne 0  ];then
echo "install sdkman err"
exit 7
fi
source "$HOME/.sdkman/bin/sdkman-init.sh"
if [ $? -ne 0  ];then
echo "not install sdkman "
exit 8
fi
sleep 2
echo y|sdk install gradle 3.0
if [ $? -ne 0  ];then
echo "install gradle err"
exit 9
fi
echo y|sdk install groovy
if [ $? -ne 0  ];then
echo "install groovy err"
exit 10
fi
source "$HOME/.sdkman/bin/sdkman-init.sh"
sleep 2

if [ ! -d "/opt/jenkins"  ];then
mkdir -p /opt/jenkins
cd  /opt/jenkins
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v$tomcat_version/bin/apache-tomcat-$tomcat_version.tar.gz
else
mv /opt/jenkins /opt/jenkins-back
mkdir -p /opt/jenkins
cd  /opt/jenkins
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v$tomcat_version/bin/apache-tomcat-$tomcat_version.tar.gz
if [ $? -ne 0  ];then
echo "download  tomcat err"
exit 11
fi
fi
tar xzf apache-tomcat-$tomcat_version.tar.gz
cd /opt/jenkins/apache-tomcat-$tomcat_version/webapps
wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war
if [ $? -ne 0  ];then
echo "download  jenkins err"
exit 12
fi
rm -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 ansible
mkdir -p /opt/ansible
cd /opt/ansible
which supervisord
if [ $? -ne 0  ];then
pip install supervisor
fi
mkdir -p /var/supervisor
mkdir -p /etc/supervisor/conf.d
echo_supervisord_conf > /etc/supervisor/supervisord.conf 
if [ $? -ne 0  ];then
echo "echo_supervisord_conf  err"
exit 13
else
sed -i 's/^;port=.*$/port=\*:9001/g' /etc/supervisor/supervisord.conf 
sed -i 's/^;\[inet_http_server\]/\[inet_http_server\]/g' /etc/supervisor/supervisord.conf 
sed -i "/port=\*:9001/a\password=admin" /etc/supervisor/supervisord.conf
sed -i "/port=\*:9001/a\username=admin" /etc/supervisor/supervisord.conf
sed -i "/\[supervisorctl\]/a\password=admin" /etc/supervisor/supervisord.conf
sed -i "/\[supervisorctl\]/a\username=admin" /etc/supervisor/supervisord.conf
sed -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 < /etc/supervisor/conf.d/jenkins.ini < /usr/lib/systemd/system/supervisord.service << EOF
[Unit]
Description=Process Monitoring and Control Daemon
After=rc-local.service

[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf 
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

EOF
systemctl enable supervisord
systemctl restart supervisord.service 
exit 0
# ansible test
echo 127.0.0.1>/etc/ansible/hosts
#ansible all -m ping --ask-pass -vvvv

windows 支持ansible net4.5 必須 PowerShell3.0 必須 windows 2008 R2 及以上的系統(tǒng)。

 ansible hosts配置 例子:

[win]
win1 ansible_ssh_host=192.168.1.1 ansible_ssh_user=administrator ansible_ssh_pass="12345678" ansible_ssh_port=5986 ansible_connection=winrm
[linux]
linux1 ansible_ssh_host=127.0.0.1   ansible_ssh_user=root    ansible_ssh_pass=123456

linux 基于ssh key文件連接配置

ssh-keygen
#輸入key文件名字:id_rsa_storm1
一直回車(chē)直到結(jié)束 分發(fā)公鑰文件 
ssh-copy-id -i root@192.168.1.1 回車(chē)輸入密碼即可
ansible hosts 配置
[linux]
linux1 ansible_ssh_host=192.168.1.130
ansible 私鑰默認(rèn)位置:/root/.ssh/id_rsa_storm1

Jenkins 訪問(wèn)端口 ip +8080 

supervisor 訪問(wèn) IP +9001 用戶(hù)及密碼 admin

下篇博客ansible 部署cobbler 

附件:http://down.51cto.com/data/2368397

分享文章:ansible+Jenkins+supervisor(Jenkins守護(hù)進(jìn)程)
本文鏈接:http://weahome.cn/article/joosoh.html

其他資訊

在線咨詢(xún)

微信咨詢(xún)

電話咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部