Skip to content

Instantly share code, notes, and snippets.

@big-samantha
Created November 12, 2012 23:18
Show Gist options
  • Save big-samantha/4062735 to your computer and use it in GitHub Desktop.
Save big-samantha/4062735 to your computer and use it in GitHub Desktop.
##../modules/haproxy/init.pp
class haproxy {
include
'::haproxy::install',
'::haproxy::config',
'::haproxy::service'
Class['::haproxy::install'] -> Class['::haproxy::config']
Class['::haproxy::config'] ~> Class['::haproxy::service']
}
##../modules/haproxy/config.pp
class haproxy::config ( $haproxycfg ) {
file { 'haproxy.cfg':
ensure => present,
content => $haproxycfg,
path => '/etc/haproxy/haproxy.cfg',
owner => root,
}
}
##now I wan't to declare or include ::haproxy somewhere, and set the $haproxycfg variable from haproxy::config
##Can I do this?
class {'haproxy':
haproxycfg => 'template('cluster/haproxy.cfg.erb')',
}
@big-samantha
Copy link
Author

The issue that I'm not clear on is that $haproxycfg is part of the haproxy::config class so I'm not sure how to set it when I declare ::haproxy as a resource somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment