Skip to content

Platform Module

Steven Borrelli edited this page Aug 26, 2016 · 6 revisions

##Platform Module

###Overview The platform module exposes facts about the underlying operating system (OS version, type, build information) to other nodes in the graph.

###Usage Platform data is available as a variable to functions and templates:

{{ platform.OS }}
{{ platform.Version }}
{{ platform.Name }} 

###Available data

  • platform.Name: Operating System Name: { Alpine Linux v3.4, Mac OS X, CentOS Linux 7 (Core) }
  • platform.OS: sourced from golang runtime.GOOS. { linux, darwin, windows...}
  • platform.Version: OS Version
  • platform.Build: build ID if available
  • platform.LinuxDistribution: Linux distribution { alpine, centos, coreos, debian, ubuntu, ... }
  • platform.Like: similar Linux platforms (for example centos is like rhel, fedora)

###Examples:

App file:

param "filename" {
    default = "platform.txt"
}

file.content "platformData" {
  destination = "{{ platform.OS }}-{{ param `filename` }}"
  content     = "Detected {{ platform.Name }} ({{ platform.OS }}) {{ platform.Version}} {{ platform.LinuxDistribution}}"
}

output:

Detected Mac OS X (darwin) 10.11.6 
Clone this wiki locally