Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move init script to config.pp to ensure it gets set AFTER the package gets installed #75

Merged
merged 1 commit into from
Jan 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,70 @@
$purge = true,
) {

if $consul::init_style {

case $consul::init_style {
'upstart' : {
file { '/etc/init/consul.conf':
mode => '0444',
owner => 'root',
group => 'root',
content => template('consul/consul.upstart.erb'),
}
file { '/etc/init.d/consul':
ensure => link,
target => "/lib/init/upstart-job",
owner => root,
group => root,
mode => '0755',
}
}
'systemd' : {
file { '/lib/systemd/system/consul.service':
mode => '0644',
owner => 'root',
group => 'root',
content => template('consul/consul.systemd.erb'),
}
}
'sysv' : {
file { '/etc/init.d/consul':
mode => '0555',
owner => 'root',
group => 'root',
content => template('consul/consul.sysv.erb')
}
}
'debian' : {
file { '/etc/init.d/consul':
mode => '0555',
owner => 'root',
group => 'root',
content => template('consul/consul.debian.erb')
}
}
'sles' : {
file { '/etc/init.d/consul':
mode => '0555',
owner => 'root',
group => 'root',
content => template('consul/consul.sles.erb')
}
}
'launchd' : {
file { '/Library/LaunchDaemons/io.consul.daemon.plist':
mode => '0644',
owner => 'root',
group => 'wheel',
content => template('consul/consul.launchd.erb')
}
}
default : {
fail("I don't know how to create an init script for style ${consul::init_style}")
}
}
}

# implicit conversion from string to int so it won't be quoted in JSON
if has_key($config_hash, 'protocol') {
$protocol_hash = {
Expand Down
64 changes: 0 additions & 64 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -63,70 +63,6 @@
fail("The provided install method ${consul::install_method} is invalid")
}

if $consul::init_style {

case $consul::init_style {
'upstart' : {
file { '/etc/init/consul.conf':
mode => '0444',
owner => 'root',
group => 'root',
content => template('consul/consul.upstart.erb'),
}
file { '/etc/init.d/consul':
ensure => link,
target => "/lib/init/upstart-job",
owner => root,
group => root,
mode => '0755',
}
}
'systemd' : {
file { '/lib/systemd/system/consul.service':
mode => '0644',
owner => 'root',
group => 'root',
content => template('consul/consul.systemd.erb'),
}
}
'sysv' : {
file { '/etc/init.d/consul':
mode => '0555',
owner => 'root',
group => 'root',
content => template('consul/consul.sysv.erb')
}
}
'debian' : {
file { '/etc/init.d/consul':
mode => '0555',
owner => 'root',
group => 'root',
content => template('consul/consul.debian.erb')
}
}
'sles' : {
file { '/etc/init.d/consul':
mode => '0555',
owner => 'root',
group => 'root',
content => template('consul/consul.sles.erb')
}
}
'launchd' : {
file { '/Library/LaunchDaemons/io.consul.daemon.plist':
mode => '0644',
owner => 'root',
group => 'wheel',
content => template('consul/consul.launchd.erb')
}
}
default : {
fail("I don't know how to create an init script for style ${consul::init_style}")
}
}
}

if $consul::manage_user {
user { $consul::user:
ensure => 'present',
Expand Down