Go has been increasingly used to write new configuration management tools. Narcissus provides a library to abstract configuration files as Go structures.
https://github.com/raphink/narcissus
2. 2/18www.camptocamp.com /
Who am I?
■ Raphaël Pinson (@raphink)
○ Infrastructure Developer & Training Leader
○ Augeas & Augeasproviders developer
○ Various contributions to Puppet & Ecosystem
3. 3/18www.camptocamp.com /
Camptocamp
■ Switzerland / France / Germany
■ Open-source development/integration expert
■ ~ 90 employees
■ Puppet user and contributor since 2008
■ Main contributor to the Puppet Forge
4. 4/18www.camptocamp.com /
Augeas: generic C library for config edition
■ Config mgmt "scalpel"
■ Bindings for many langages
■ Used in libvirt, nut, etc.
■ Integrated in Puppet, Ansible,
Salt, etc.
■ > 300 parsers (lenses)
augeas.net
5. 5/18www.camptocamp.com /
Augeasproviders: Puppet library for config providers
■ Provides resource abstraction
■ Declarative API to link
parameters to tree
nodes/labels
■ ~20 existing types/providers
augeasproviders.com
6. 6/18www.camptocamp.com /
Augeasproviders: Declarative API
resource_path do |resource|
service = resource[:service]
type = resource[:type]
mod = resource[:module]
control_cond = (resource[:control_is_param] == :true) ? "and control='#{resource[:control]}'" : ''
if target == '/etc/pam.conf'
"$target/*[service='#{service}' and type='#{type}' and module='#{mod}' #{control_cond}]"
else
"$target/*[type='#{type}' and module='#{mod}' #{control_cond}]"
end
end
7. 7/18www.camptocamp.com /
What about go?
■ Many new cfgmgmt tools
written in go
■ Augeas bindings for go
■ No abstraction for generic
config files yet
8. 8/18www.camptocamp.com /
Augeas bindings for go
■ github.com/dominikh/go-
augeas
■ Simple mapping to
Augeas API
■ No config file abstraction
package main
import (
"honnef.co/go/augeas"
"fmt"
)
func main() {
ag, err := augeas.New("/", "", augeas.None)
if err != nil {
panic(err)
}
version, err := ag.Get("/augeas/version")
fmt.Println(version, err)
}