Sha256: bcd5a249bf161ec4686621803592c8b5430f2c977c8d7381f931d112b0b65412

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

environment_content =
  <<-EOS
GOMAXPROCS=#{node[:consul][:gomaxprocs]}
OPTIONS="#{node[:consul][:options]}"
  EOS

# Set systemd unit file
define :set_consul_systemd_unit do
  environment_file = params[:name]

  file environment_file do
    mode    "644"
    content environment_content
  end

  template "/etc/systemd/system/consul.service" do
    mode "644"
    variables(
      environment_file: environment_file,
      bin_path:         "#{node[:consul][:bin_dir]}/consul",
      data_dir:         node[:consul][:data_dir],
    )

    notifies :run,     "execute[systemctl daemon-reload]"
    notifies :restart, "service[consul]"
  end

  execute "systemctl daemon-reload" do
    action :nothing
  end
end

# Set init.d script
define :set_consul_initd_script do
  environment_file = params[:name]

  file environment_file do
    mode    "644"
    content environment_content
  end

  template "/etc/init.d/consul" do
    mode "755"
    variables(
      environment_file: environment_file,
      bin_path:         "#{node[:consul][:bin_dir]}/consul",
      data_dir:         node[:consul][:data_dir],
    )

    notifies :restart, "service[consul]"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
itamae-plugin-recipe-consul-0.1.0 lib/itamae/plugin/recipe/consul/service/definitions.rb
itamae-plugin-recipe-consul-0.1.0.beta3 lib/itamae/plugin/recipe/consul/service/definitions.rb