Sha256: 42d034ba4bb23b724bfd25dbfc60f2456af5dc28b03e24edf74849e01c328fc0

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 KB

Contents

alt_god = ENV['ALTERNATIVE_GOD']
god_gem =
  case ::File.basename(alt_god.to_s)
  when %r!\Agod-.gem\z! then  # If package_name starts with 'god-' and ends with '.gem', then version can be extracted.
    { package: alt_god,
      version: ::File.basename(alt_god)[/god-(.+)\.gem/, 1]
    }
  when %r!\.gem\z! then  # Ends with '.gem'
    { package: alt_god,
      version: nil
    }
  when %r!\A\S+\z! then  # Matches characters without white spaces
    { package: alt_god,
      version: ENV['ALTERNATIVE_GOD_VERSION']
    }
  else
    { package: 'god',
      version: '0.13.7'
    }
  end

gem_package 'god' do
  package_name god_gem[:package]
  version god_gem[:version]
  options ['-N']
  user 'root'
end

directory '/etc/god' do
  user 'root'
  owner 'root'
  group 'root'
  mode '755'
end

template '/etc/god/master.conf' do
  user 'root'
  owner 'root'
  group 'root'
  mode '644'
end

ruby_bin_dir = node.languages.ruby.bin_dir rescue nil
service_variables = {
  god_bin: (ruby_bin_dir ? "#{ruby_bin_dir}/god" : 'god'),
  pid: '/var/run/god.pid',
  config: '/etc/god/master.conf',
  log: '/var/log/god.log',
  log_level: 'info'
}

case "#{node.platform_family}-#{node.platform_version}"
when /rhel-6\.(.*?)/
  template '/etc/init.d/god' do
    user 'root'
    owner 'root'
    group 'root'
    mode '755'
    variables service_variables
  end
else
  template '/etc/systemd/system/god.service' do
    user 'root'
    owner 'root'
    group 'root'
    mode '755'
    variables service_variables
  end
end

template '/etc/logrotate.d/god' do
  user 'root'
  owner 'root'
  group 'root'
  mode '644'
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
itamae-plugin-recipe-god-0.2.7 lib/itamae/plugin/recipe/god/install.rb
itamae-plugin-recipe-god-0.2.6 lib/itamae/plugin/recipe/god/install.rb
itamae-plugin-recipe-god-0.2.5 lib/itamae/plugin/recipe/god/install.rb