【问题标题】:Cloudformation metadata commandsCloudformation 元数据命令
【发布时间】:2015-10-08 14:12:58
【问题描述】:

我正在尝试学习 Cloudformation。 有人可以向我解释为什么1-install-roles 编号为“1”吗? 这条线是做什么的"if not \"None\" EQU \"",

Resource("WindowsServer") do
    Type("AWS::EC2::Instance")
    Metadata("AWS::CloudFormation::Init", {
  "config" => {
    "commands" => {
      "1-install-roles"    => {
        "command" => FnJoin("", [
  "if not \"None\" EQU \"",
  Ref("Roles"),
  "\" (powershell.exe add-windowsfeature ",
  Ref("Roles"),
  " -restart)"
])

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation


    【解决方案1】:

    1- 用于排序以确保命令首先执行。它按字母顺序执行。 if not \"None\" EQU \" 位是windows批处理脚本。EQU是比较运算符,意思是“相等”。

    假设对 Roles 的引用返回字符串“Something”,执行的命令将是:

    如果不是 "None" EQU "Something" "(powershell.exe add-windowsfeature Something -restart)"

    【讨论】:

    • 如果我指定了序列,是否会等到第一个序列完成后再执行下一个序列?
    猜你喜欢
    • 2018-04-26
    • 1970-01-01
    • 1970-01-01
    • 2017-09-12
    • 1970-01-01
    • 2018-03-12
    • 2021-08-31
    • 1970-01-01
    • 2017-12-18
    相关资源
    最近更新 更多