从盐柱传递神仙variables脚本

使用salt来提供,我希望能够运行cmd.script。 如果我列出了所有打算在脚本中安装的软件包,脚本就能正常工作。 但是我更愿意在salt公式中包含包的列表,并从脚本中引用它。 下面的工作确定。

盐式

Run masterscript: cmd.script: - name: masterscript - source: http://server/r-install.sh 

r-install.sh

 IFS="," packages="'devtools','shiny','rmarkdown','plyr','shinydashboard','googleVis','RPostgreSQL','reshape2','xtable','DT','lattice','latticeExtra','ggplot2','formattable','plotly','htmlwidgets','shinyBS','stringr','DBI'" for i in $packages; do su - -c "R -e \"install.packages($i, repos='http://cran.rstudio.com')\""; done 

我宁愿列出支柱上的包装,即:

 r: packages: - package1 - package2 

盐式:

 Run masterscript: cmd.script: - name: masterscript - source: http://server/r-install.sh - template: jinja 

r-install.sh:

 {%- for package in salt['pillar.get']('r:packages', []) %} su - -c "R -e \"install.packages({{package}}, repos='http://cran.rstudio.com')\"" {% endfor -%}