configset

You can use the configset method to build multiple configset blocks within one configset. This allow you to better organize large configsets. Also, as noted in AWS::CloudFormation::Init, cfn-init processes configuration sections in a specific order. So this can also be useful if you need to more control over ordering.

The cfn-init processes sections according to the following order AWS::CloudFormation::Init :

  1. packages
  2. groups
  3. users
  4. sources
  5. files
  6. commands
  7. services

Example

configset("configset-1") do
  command("create-file",
    command: "touch /tmp/test.txt",
    test: "test -e /tmp/test.txt",
  )
end
configset("configset-2") do
  command("uptime-command",
    command: "uptime"
  )
end

Generates:

---
AWS::CloudFormation::Init:
  configSets:
    default:
    - configset-1
    - configset-2
  configset-1:
    commands:
      001_create-file:
        command: touch /tmp/test.txt
        test: test -e /tmp/test.txt
  configset-2:
    commands:
      001_uptime-command:
        command: uptime

Notice, how you do not have to define the configSets key. Lono automatically generates configSets structure using the order which you declare the configset blocks.

Back to DSL Docs