github.com/swiftstack/proxyfs@v0.0.0-20201223034610-5434d919416e/cookbooks/swift/recipes/default.rb (about) 1 # Copyright (c) 2015 SwiftStack, Inc. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 # implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 17 include_recipe "swift::setup" 18 include_recipe "swift::source" 19 include_recipe "swift::data" 20 include_recipe "swift::configs" 21 include_recipe "swift::rings" 22 23 # start main 24 25 cookbook_file "/usr/lib/systemd/system/swift.service" do 26 source "usr/lib/systemd/system/swift.service" 27 # notifies :restart, 'service[swift]' 28 only_if { ::File.directory?("/usr/lib/systemd/system/") } 29 end 30 31 # Enable Swift to start at bootup on Centos 32 # 33 # 34 if node[:platform_family].include?("rhel") 35 execute "Enable Swift to start at bootup on Centos" do 36 command "/usr/bin/systemctl enable swift.service" 37 end 38 end 39 40 cookbook_file "/etc/init/swift.conf" do 41 source "etc/init/swift.upstart" 42 # notifies :restart, 'service[swift]' 43 only_if { ::File.directory?("/etc/init") } 44 end 45 46 execute "startmain" do 47 command "sudo -u #{node['swift_user']} swift-init start main" 48 end 49