由于没有用于Anaconda的软件包,如何通过Salt安装和管理
对于快速入门指南中描述的安装,我必须下载一个安装程序(例如Anaconda-2.1.0-Linux-x86_64.sh),然后在shell中执行
bash <downloaded file>我是否必须为salt编写一个花哨的python安装程序,或者有没有一种更简单的方法让salt知道如何安装Anaconda?
发布于 2014-12-30 05:24:59
我认为您最好的选择是使用这里记录的cmd.script状态:http://docs.saltstack.com/en/latest/ref/states/all/salt.states.cmd.html#salt.states.cmd.script
运行此命令的Salt状态示例如下所示。假设您已经将anaconda安装程序复制到您的Salt Master上的这个位置:/srv/salt/Anaconda-2.1.0-Linux-x86_64.sh
/srv/salt/install_anaconda.sls的内容
run_anaconda_installer:
cmd.script:
- source: salt://Anaconda-2.1.0-Linux-x86_64.sh
- creates: /usr/bin/anaconda # This should be a path to a file or directory created by Anaconda-2.1.0-Linux-x86_64.sh. This will cause Salt not to rerun this install script if that file or directory already exist.
- user: root
- group: root发布于 2016-12-15 17:59:27
我猜自从最初提出这个问题以来,这一点已经改变了,但现在您可以简单地将-b参数传递给脚本以在批处理模式下运行。我的salt状态也将其作为根用户安装在/opt下,如下所示:
/opt/Miniconda2-latest-Linux-x86_64.sh:
cmd.run:
- name: >
wget --continue
https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh
-O /opt/Miniconda2-latest-Linux-x86_64.sh
- creates: /opt/miniconda2
/opt/miniconda:
cmd.script:
- name: /opt/Miniconda2-latest-Linux-x86_64.sh
- args: -b -p /opt/miniconda2
- creates: /opt/miniconda2两人都说他们创建了/opt/miniconda2文件夹,这样我们就不会因此而多次访问互联网。
https://stackoverflow.com/questions/27693871
复制相似问题