使用带校验和的远程tarball安装包的Saltstack公式

时间:2014-01-10 12:35:33

标签: python salt-stack

如何使用盐堆从tar球安装包?例如,我想从远程tar球安装Apache Tomcat - 我该如何实现?我尝试使用file.managed,但它在source_hash中显示不匹配 - 如何使用源URL动态预测校验和?

{% set tomcat = pillar.get('tomcat', {}) -%}
{% set version = tomcat.get('version', 'x.x.x') -%}
{% set tomcat_package = source + '/tomact-' + version + '.tar.gz' -%}
  file.managed:
    - name: {{ tomcat_package }}
    - source: http://tomcat.org/download/tomcat-{{ version }}.tar.gz
    - source_hash: {{ checksum }}

1 个答案:

答案 0 :(得分:3)

file.managed仅为您下载该文件。要提取它,请查看archive.extracted

tomcat:
  archive:
    - extracted
    - name: /opt/
    - source: http://mirrors.digipower.vn/apache/tomcat/tomcat-7/v7.0.47/bin/apache-tomcat-7.0.47.tar.gz
    - source_hash: md5=efbae77efad579b655ae175754cad3df
    - archive_format: tar
    - options: z
    - if_missing: /opt/apache-tomcat-7.0.47