运维自动化实践笔记

由两部分组成,BS架构的OMserver作为UI客户端交互和saltstack作为主控端服务。

选择saltstack的原因
1. 基于Python,便于二次开发
2. saltstack使用消息队列zeroMQ传输数据,更快更稳,ansible基于ssh协议传输数据
3. 使用salt-ssh 安装 salt-minion ,平衡了ansible 不需要安装代理的优势

搭建OMserver脚本如下:

function install_pcre(){
    wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
    tar zxvf pcre-8.40.tar.gz 
    cd pcre-8.40
    ./configure
    make && make install
    echo "################################# install pcre success"
    cd ..
    }

function install_nginx(){
    wget http://nginx.org/download/nginx-1.5.9.tar.gz
    tar zxvf nginx-1.5.9.tar.gz 
    cd nginx-1.5.9
    ./configure --user=nobody --group=nobody --prefix=/usr/local/nginx --with-http_stub_status_module --with-cc-opt='-O3' --with-cpu-opt=opteron
    make
    make install
    echo "################################# install nginx success"
    cd ..
}

function install_uwsgi(){
    wget http://projects.unbit.it/downloads/uwsgi-2.0.4.tar.gz
    tar zxvf uwsgi-2.0.4.tar.gz 
    cd uwsgi-2.0.4
    ls
    make 
    cp uwsgi /usr/bin
    #error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
    # 32bit
    #ln -s /usr/local/lib/libpcre.so.1 /lib
    # 64bit
    ln -s /usr/local/lib/libpcre.so.1 /lib64
    echo "################################# install pcre success"
    cd ..
}


function install_django(){
    wget --no-check-certificate https://www.djangoproject.com/m/releases/1.4/Django-1.4.9.tar.gz
    tar zxvf Django-1.4.9.tar.gz 
    cd Django-1.4.9
    python setup.py install
    echo "################################# install django success"
    cd ..
}
function install_mysql_python(){
    wget  https://pypi.python.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip#md5=654f75b302db6ed8dc5a898c625e030c
    unzip MySQL-python-1.2.5.zip
    cd MySQL-python-1.2.5
    python setup.py install
    cd ..
}

function install_django_debug_toolbar(){
    wget https://github.com/robhudson/django-debug-toolbar/archive/master.zip
    mv master.zip django-debug-toolbar.zip
    unzip django-debug-toolbar.zip 
    cd django-debug-toolbar-master/
    python setup.py  install
    cd ..
}

cd /data
mkdir auto_operator
cd auto_operator/
mdkir /data/logs
mkdir -p /data/www/OMserverweb

install_pcre
# nginx 安装需要zlib
# 解决没有Python.h
sudo yum -y install zlib-devel zlib python-devel.x86_64
install_nginx
install_uwsgi
install_django
install_mysql_python
install_django_debug_toolbar

echo "config nginx.conf"
#vim /usr/local/nginx/conf/nginx.conf

echo "config uwsgi.ini"
#vim /usr/local/nginx/conf/uwsgi.ini

echo "start uwsgi"
#/usr/bin/uwsgi --ini /usr/local/nginx/conf/uwsgi.ini 

echo "start nginx"
#/usr/local/nginx/sbin/nginx
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值