github.com/swiftstack/ProxyFS@v0.0.0-20210203235616-4017c267d62f/cookbooks/swift/recipes/default.rb (about)

     1  # Copyright (c) 2015-2021, NVIDIA CORPORATION.
     2  # SPDX-License-Identifier: Apache-2.0
     3  
     4  
     5  include_recipe "swift::setup"
     6  include_recipe "swift::source"
     7  include_recipe "swift::data"
     8  include_recipe "swift::configs"
     9  include_recipe "swift::rings"
    10  
    11  # start main
    12  
    13  cookbook_file "/usr/lib/systemd/system/swift.service" do
    14    source "usr/lib/systemd/system/swift.service"
    15    # notifies :restart, 'service[swift]'
    16    only_if { ::File.directory?("/usr/lib/systemd/system/") }
    17  end
    18  
    19  # Enable Swift to start at bootup on Centos
    20  #
    21  #
    22  if node[:platform_family].include?("rhel")
    23    execute "Enable Swift to start at bootup on Centos" do
    24    command "/usr/bin/systemctl enable swift.service"
    25    end
    26  end
    27    
    28  cookbook_file "/etc/init/swift.conf" do
    29    source "etc/init/swift.upstart"
    30    # notifies :restart, 'service[swift]'
    31    only_if { ::File.directory?("/etc/init") }
    32  end
    33    
    34  execute "startmain" do
    35    command "sudo -u #{node['swift_user']} swift-init start main"
    36  end
    37