zoukankan      html  css  js  c++  java
  • salt一键部署python

    1.准备工作

    我们来看一下一键部署python的脚本。

    python-file:
      file.managed:
       - source: salt://python/Python-2.7.8.tar.gz
       - name: /opt/Python-2.7.8.tar.gz
       - user: root
       - group: root
    
    python-install:
      cmd.run:
       - name: 'cd /opt && tar zxvf Python-2.7.8.tar.gz && ln -s /opt/Python-2.7.8  /opt/python && chown -R root:root /opt/*ython*'
       - unless: 'test -d /opt/Python-2.7.8'
       - require:
         - file: python-file
     
    python-rmtgz:
      file.absent:
        - name: /opt/Python-2.7.8.tar.gz
    	- require:
          - cmd: python-install
    	
    	
    /etc/profile:
      file.append:
        - text:
          - export PATH=/opt/python/bin:$PATH
    	- require:
         - file: python-rmtgz
    	 
    /etc/ld.so.conf:
      file.append:
        - text:
          - /opt/python/lib
    	- require:
         - file: python-rmtgz
    	 
    source-ld.so.conf:
       cmd.run:
        - name: 'ldconfig'
    	- require:
          - file: /etc/ld.so.conf
    

      

    我们查看salt的入口文件,top.sls中的内容:

    2.一键部署执行命令。

    s3:
    ..........//省略

    Python-2.7.8/bin/redis-profiler
    Python-2.7.8/bin/python-config
    Python-2.7.8/bin/fab
    Python-2.7.8/bin/easy_install
    Python-2.7.8/bin/easy_install-2.7
    Python-2.7.8/bin/uwsgi
    Python-2.7.8/bin/django-admin
    Python-2.7.8/bin/f2py
    Python-2.7.8/bin/sqlformat
    ----------
    ID: python-rmtgz
    Function: file.absent
    Name: /opt/Python-2.7.8.tar.gz
    Result: True
    Comment: Removed file /opt/Python-2.7.8.tar.gz
    Started: 01:10:03.761017
    Duration: 79.413 ms
    Changes:
    ----------
    removed:
    /opt/Python-2.7.8.tar.gz
    ----------
    ID: /etc/profile
    Function: file.append
    Result: True
    Comment: File /etc/profile is in correct state
    Started: 01:10:03.840725
    Duration: 3.981 ms
    Changes:
    ----------
    ID: /etc/ld.so.conf
    Function: file.append
    Result: True
    Comment: File /etc/ld.so.conf is in correct state
    Started: 01:10:03.844890
    Duration: 1.775 ms
    Changes:
    ----------
    ID: source-ld.so.conf
    Function: cmd.run
    Name: ldconfig
    Result: True
    Comment: Command "ldconfig" run
    Started: 01:10:03.846813
    Duration: 16.212 ms
    Changes:
    ----------
    pid:
    28582
    retcode:
    0
    stderr:
    stdout:

    Summary for s3
    ------------
    Succeeded: 6 (changed=4)
    Failed: 0
    ------------
    Total states run: 6
    Total run time: 35.878 s

      这样我们去s2机器上就可以看到jdk已经安装成功了。

  • 相关阅读:
    python(内置高阶函数)
    cms 环境搭建
    cookie、session 和 token 区别
    接口用例设计
    python(字符编码与转码)
    从北斗卫星时钟(北斗校时器)发展纵论世界卫星导航新格局
    北斗授时系统(GPS授时设备)错一秒会怎样?京准电子科技
    北斗校时服务器(GPS时钟服务器)在电力调度系统应用
    GPS卫星时钟(北斗授时设备)在监狱管理系统方案
    NTP校时(网络对时服务器)IPC网络摄像机时钟同步
  • 原文地址:https://www.cnblogs.com/wyl9527/p/6859728.html
Copyright © 2011-2022 走看看