Configset Structure

Here’s an example lono configset structure:

├── lib
│   ├── helpers/
│   ├── configset.rb
│   ├── meta.rb
│   └── variables.rb
└── httpd.gemspec
File Description Required?
helpers Where you define custom helpers and extend the configset DSL. optional
configset.rb The configset code. The top-level key should be AWS::CloudFormation::Init. required
meta.rb Additional meta info about the configset. Supports depends_on, to specify other configsets as dependencies. optional
variables.rb Predefined variables shipped with the configset. Predefined variables can be overridden with Configset Variables. optional
httpd.gemspec A standard gemspec definition. Configure things like name and author. required

lono configset new

A quick way create a project configset is with the lono configset new command. It will generate a skeleton configset structure in app/configsets.

$ lono configset new httpd
=> Creating new configset called httpd.
      create  app/configsets/httpd
      create  app/configsets/httpd/httpd.gemspec
      create  app/configsets/httpd/.gitignore
      create  app/configsets/httpd/.rspec
      create  app/configsets/httpd/Gemfile
      create  app/configsets/httpd/README.md
      create  app/configsets/httpd/Rakefile
      create  app/configsets/httpd/lib/configset.rb
$

Configset Example

Here’s a simple configset example in DSL form.

app/configsets/httpd/lib/configset.rb:

package("yum",
  httpd: []
)
file("/var/www/html/index.html",
  content: "<h2>html test content</h2>"
)
service("sysvinit",
  httpd: {
    enabled: true,
    ensureRunning: true,
  }
)

The configet can also be written in ERB form.

app/configsets/httpd/lib/configset.yml:

AWS::CloudFormation::Init:
  config:
    packages:
      yum:
        httpd: []
    files:
      "/var/www/html/index.html":
        content: "<h2>html test content</h2>"
    services:
      sysvinit:
        httpd:
          enabled: true
          ensureRunning: true

This configset will install, configure, and ensure that the httpd server is running, even if the server is rebooted.

meta.rb depends_on example

Configsets can depend on other configsets. The depends_on method allows you to reuse configsets by including them as separate dependencies, instead of copying and pasting the configset code. Example:

lib/meta.rb

depends_on "amazon-linux-extras"

Pro tip: Use the <- and -> arrow keys to move back and forward.

Edit this page

See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!