github.com/swiftstack/proxyfs@v0.0.0-20201223034610-5434d919416e/cookbooks/proxyfs/recipes/default.rb (about) 1 require 'json' 2 3 source_root = node['source_root'] 4 proxyfs_user = node['proxyfs_user'] 5 proxyfs_group = node['proxyfs_group'] 6 is_dev = node['is_dev_environment'] 7 ss_packages = node['use_swiftstack_packages'] 8 package_spec_path = node['package_spec_path'] 9 10 HOME_DIR = "/home/#{proxyfs_user}" 11 DOT_BASH_PROFILE = "#{HOME_DIR}/.bash_profile" 12 DOT_BASHRC = "#{HOME_DIR}/.bashrc" 13 ROOT_DOT_BASH_PROFILE = "/root/.bash_profile" 14 ROOT_DOT_BASHRC = "/root/.bashrc" 15 ETC_BASHRC = "/etc/bashrc" 16 REPO_CLONE_PARENT_DIR = "#{source_root}/src/github.com/swiftstack" 17 PROXYFS_BIN_DIR = "#{source_root}/bin" 18 PROXYFS_SRC_DIR = "#{REPO_CLONE_PARENT_DIR}/ProxyFS" 19 VFS_SRC_DIR = "#{PROXYFS_SRC_DIR}/vfs" 20 JRPCCLIENT_SRC_DIR = "#{PROXYFS_SRC_DIR}/jrpcclient" 21 # We're doing this to only need to change SAMBA_PARENT_DIR in case we decide to 22 # change the location of samba again in the future. 23 SAMBA_PARENT_DIR = "#{VFS_SRC_DIR}" 24 SAMBA_SRC_DIR = "#{SAMBA_PARENT_DIR}/samba" 25 26 if node[:platform_family].include?("rhel") and ss_packages 27 cookbook_file "/etc/yum.repos.d/swiftstack-controller.repo" do 28 source "etc/yum.repos.d/swiftstack-controller.repo" 29 owner "root" 30 group "root" 31 end 32 33 cookbook_file "/etc/pki/rpm-gpg/RPM-GPG-KEY-swiftstack-controller" do 34 source "etc/pki/rpm-gpg/RPM-GPG-KEY-swiftstack-controller" 35 owner "root" 36 group "root" 37 end 38 39 execute "yum makecache" do 40 command "yum makecache" 41 end 42 end 43 44 ruby_block "update_profile_and_bashrc" do 45 block do 46 47 unless File.exist?(DOT_BASH_PROFILE) 48 File.open(DOT_BASH_PROFILE, "w") do |fh| 49 # nothing to do here, just making an empty file 50 end 51 end 52 53 file = Chef::Util::FileEdit.new(DOT_BASH_PROFILE) 54 file.insert_line_if_no_match(/\. ~\/.bashrc/, ". ~/.bashrc") 55 file.insert_line_if_no_match(/\. ~\/.profile/, "if [ -f ~/.profile ]; then . ~/.profile; fi") 56 file.write_file 57 58 unless File.exist?(ETC_BASHRC) 59 File.open(ETC_BASHRC, "w") do |fh| 60 # nothing to do here, just creating an empty file 61 end 62 end 63 64 file = Chef::Util::FileEdit.new(ETC_BASHRC) 65 file.insert_line_if_no_match(/ulimit/, "ulimit -c 0") 66 file.write_file 67 68 unless File.exist?(DOT_BASHRC) 69 File.open(DOT_BASHRC, "w") do |fh| 70 # nothing to do here, just creating an empty file 71 end 72 end 73 74 file = Chef::Util::FileEdit.new(DOT_BASHRC) 75 file.insert_line_if_no_match(/export GOPATH/, "export GOPATH=#{source_root}") 76 if ss_packages 77 file.insert_line_if_no_match(%r{usr/local/go/bin}, "export PATH=$GOPATH/bin:$PATH:/usr/local/go/bin:/opt/ss/bin:/opt/ss/sbin") 78 else 79 file.insert_line_if_no_match(%r{usr/local/go/bin}, "export PATH=$GOPATH/bin:$PATH:/usr/local/go/bin") 80 end 81 file.insert_line_if_no_match(/cdpfs/, "alias cdpfs='cd $GOPATH/src/github.com/swiftstack/ProxyFS'") 82 file.insert_line_if_no_match(/cdfun/, "alias cdfun='cd /home/swift/code/functional-tests'") 83 file.insert_line_if_no_match(/cdsamba/, "alias cdsamba='cd #{SAMBA_SRC_DIR}'") 84 file.insert_line_if_no_match(/ls -lha/, "alias la='ls -lha'") 85 file.insert_line_if_no_match(/ls -liha/, "alias li='ls -liha'") 86 file.insert_line_if_no_match(/statmnt/, "alias statmnt='stat /mnt/*'") 87 file.insert_line_if_no_match(/ST_AUTH/, "export ST_AUTH=http://localhost:8080/auth/v1.0") 88 file.insert_line_if_no_match(/ST_USER/, "export ST_USER=test:tester") 89 file.insert_line_if_no_match(/ST_KEY/, "export ST_KEY=testing") 90 file.write_file 91 92 unless File.exist?(ROOT_DOT_BASH_PROFILE) 93 File.open(ROOT_DOT_BASH_PROFILE, "w") do |fh| 94 # nothing to do here, just making an empty file 95 end 96 end 97 98 file = Chef::Util::FileEdit.new(ROOT_DOT_BASH_PROFILE) 99 file.insert_line_if_no_match(/\. ~\/.bashrc/, ". ~/.bashrc") 100 file.insert_line_if_no_match(/\. ~\/.profile/, "if [ -f ~/.profile ]; then . ~/.profile; fi") 101 file.write_file 102 103 unless File.exist?(ROOT_DOT_BASHRC) 104 File.open(ROOT_DOT_BASHRC, "w") do |fh| 105 # nothing to do here, just creating an empty file 106 end 107 end 108 109 file = Chef::Util::FileEdit.new(ROOT_DOT_BASHRC) 110 file.insert_line_if_no_match(/export GOPATH/, "export GOPATH=#{source_root}") 111 if ss_packages 112 file.insert_line_if_no_match(%r{usr/local/go/bin}, "export PATH=$GOPATH/bin:$PATH:/usr/local/go/bin:/opt/ss/bin:/opt/ss/sbin") 113 else 114 file.insert_line_if_no_match(%r{usr/local/go/bin}, "export PATH=$GOPATH/bin:$PATH:/usr/local/go/bin") 115 end 116 file.insert_line_if_no_match(/cdpfs/, "alias cdpfs='cd $GOPATH/src/github.com/swiftstack/ProxyFS'") 117 file.insert_line_if_no_match(/cdfun/, "alias cdfun='cd /home/swift/code/functional-tests'") 118 file.insert_line_if_no_match(/cdsamba/, "alias cdsamba='cd #{SAMBA_SRC_DIR}'") 119 file.insert_line_if_no_match(/ls -lha/, "alias la='ls -lha'") 120 file.insert_line_if_no_match(/ls -liha/, "alias li='ls -liha'") 121 file.insert_line_if_no_match(/statmnt/, "alias statmnt='stat /mnt/*'") 122 file.insert_line_if_no_match(/ST_AUTH/, "export ST_AUTH=http://localhost:8080/auth/v1.0") 123 file.insert_line_if_no_match(/ST_USER/, "export ST_USER=test:tester") 124 file.insert_line_if_no_match(/ST_KEY/, "export ST_KEY=testing") 125 file.write_file 126 127 end 128 end 129 130 cookbook_file "/usr/local/go/src/runtime/runtime-gdb.py" do 131 source "usr/local/go/src/runtime/runtime-gdb.py" 132 end 133 134 if node[:platform_family].include?("rhel") 135 # Centos uses SELinux which causes Samba problems mounting. 136 # Disable SeLinux. 137 ruby_block "update_selinux" do 138 block do 139 sysconfig_selinux = "/etc/sysconfig/selinux" 140 141 # The file will not exist if we are running in a Centos container 142 # on a Ubuntu system. 143 if File.file?(sysconfig_selinux) 144 file = Chef::Util::FileEdit.new(sysconfig_selinux) 145 file.search_file_replace(/^SELINUX=enforcing/, "SELINUX=permissive") 146 file.write_file 147 end 148 end 149 end 150 end 151 152 execute "Install pfs-swift-load-plot requirements" do 153 command "pip install -r #{PROXYFS_SRC_DIR}/pfs-swift-load/requirements.txt" 154 end 155 156 execute "Create ProxyFS/bin dir" do 157 command "mkdir #{PROXYFS_BIN_DIR}" 158 not_if { ::Dir.exists?("#{PROXYFS_BIN_DIR}") } 159 end 160 161 execute "Copy pfs-swift-load-plot at /home/swift/code/ProxyFS/bin/" do 162 command "install -m 0755 #{PROXYFS_SRC_DIR}/pfs-swift-load/pfs-swift-load-plot #{PROXYFS_BIN_DIR}/" 163 end 164 165 execute "Install awscli and awscli-plugin-endpoint" do 166 command "pip install awscli awscli-plugin-endpoint" 167 end 168 169 if is_dev 170 ruby_block "fuse_user_allow_other" do 171 block do 172 file = Chef::Util::FileEdit.new("/etc/fuse.conf") 173 file.search_file_delete_line(/#user_allow_other/) 174 file.insert_line_if_no_match(/^user_allow_other/, "user_allow_other") 175 file.write_file 176 end 177 end 178 179 file "/etc/fuse.conf" do 180 mode '0644' # globally readable 181 end 182 end 183 184 directory '/CommonMountPoint' do 185 # perms/owner don't really matter since it gets mounted over, but 186 # this helps stop a developer from accidentally dumping stuff on the 187 # root filesystem 188 owner 'root' 189 end 190 191 directory '/var/lib/proxyfs' do 192 mode '0755' 193 owner proxyfs_user 194 group proxyfs_group 195 end 196 197 directory '/var/log/proxyfsd' do 198 mode '0755' 199 owner proxyfs_user 200 group proxyfs_group 201 end 202 203 link '/etc/proxyfsd' do 204 to "#{source_root}/src/github.com/swiftstack/ProxyFS/proxyfsd/" 205 link_type :symbolic 206 owner proxyfs_user 207 group proxyfs_group 208 end 209 210 link '/etc/pfsagentd' do 211 to "#{source_root}/src/github.com/swiftstack/ProxyFS/pfsagentd/" 212 link_type :symbolic 213 owner proxyfs_user 214 group proxyfs_group 215 end 216 217 template "/usr/bin/start_and_mount_pfs" do 218 mode '0755' 219 source "usr/bin/start_and_mount_pfs.erb" 220 variables({ 221 :swift_user => node['swift_user'], 222 :swift_uid => node['swift_uid'], 223 :swift_gid => node['swift_gid'] 224 }) 225 end 226 227 execute "Provision start_swift_only" do 228 command "install -m 0755 #{source_root}/src/github.com/swiftstack/ProxyFS/cookbooks/proxyfs/files/default/usr/bin/start_swift_only /usr/bin" 229 end 230 231 execute "Provision start_proxyfsd_only" do 232 command "install -m 0755 #{source_root}/src/github.com/swiftstack/ProxyFS/cookbooks/proxyfs/files/default/usr/bin/start_proxyfsd_only /usr/bin" 233 end 234 235 execute "Provision stop_proxyfsd_only" do 236 command "install -m 0755 #{source_root}/src/github.com/swiftstack/ProxyFS/cookbooks/proxyfs/files/default/usr/bin/stop_proxyfsd_only /usr/bin" 237 end 238 239 execute "Provision unmount_and_stop_pfs" do 240 command "install -m 0755 #{source_root}/src/github.com/swiftstack/ProxyFS/cookbooks/proxyfs/files/default/usr/bin/unmount_and_stop_pfs /usr/bin" 241 end 242 243 execute "Provision set_up_s3api" do 244 command "install -m 0755 #{source_root}/src/github.com/swiftstack/ProxyFS/cookbooks/proxyfs/files/default/usr/bin/set_up_s3api /usr/bin" 245 end 246 247 execute "Provision set_up_swift3" do 248 command "install -m 0755 #{source_root}/src/github.com/swiftstack/ProxyFS/cookbooks/proxyfs/files/default/usr/bin/set_up_swift3 /usr/bin" 249 end 250 251 execute "Provision enable_s3" do 252 command "install -m 0755 #{source_root}/src/github.com/swiftstack/ProxyFS/cookbooks/proxyfs/files/default/usr/bin/enable_s3 /usr/bin" 253 end 254 255 execute "Provision disable_s3" do 256 command "install -m 0755 #{source_root}/src/github.com/swiftstack/ProxyFS/cookbooks/proxyfs/files/default/usr/bin/disable_s3 /usr/bin" 257 end 258 259 execute "Provision detect_s3" do 260 command "install -m 0755 #{source_root}/src/github.com/swiftstack/ProxyFS/cookbooks/proxyfs/files/default/usr/bin/detect_s3 /usr/bin" 261 end 262 263 execute "Provision pfs_stat" do 264 command "install -m 0755 #{source_root}/src/github.com/swiftstack/ProxyFS/bin/pfs_stat /usr/bin" 265 end 266 267 cookbook_file "/usr/lib/systemd/system/proxyfsd.service" do 268 source "usr/lib/systemd/system/proxyfsd.service" 269 # notifies :restart, 'service[proxyfsd]' 270 only_if { ::File.directory?("/usr/lib/systemd/system/") } 271 end 272 273 cookbook_file "/usr/lib/systemd/system/pfsagentd.service" do 274 source "usr/lib/systemd/system/pfsagentd.service" 275 only_if { ::File.directory?("/usr/lib/systemd/system/") } 276 end 277 278 if node[:platform_family].include?("rhel") and ss_packages 279 cookbook_file "/usr/lib/systemd/system/smb.service" do 280 source "usr/lib/systemd/system/smb.service" 281 # notifies :restart, 'service[smb]' 282 only_if { ::File.directory?("/usr/lib/systemd/system/") } 283 end 284 285 cookbook_file "/usr/lib/systemd/system/nmb.service" do 286 source "usr/lib/systemd/system/nmb.service" 287 # notifies :restart, 'service[nmb]' 288 only_if { ::File.directory?("/usr/lib/systemd/system/") } 289 end 290 end 291 292 cookbook_file "/etc/init/proxyfsd.conf" do 293 source "etc/init/proxyfsd.upstart" 294 # notifies :restart, 'service[proxyfsd]' 295 only_if { ::File.directory?("/etc/init") } 296 end 297 298 299 # 300 # Dependency lists by OS 301 # 302 if node[:platform_family].include?("rhel") 303 if ss_packages 304 package_spec_file_path = File.read(package_spec_path + '/rhel_ss.json') 305 else 306 package_spec_file_path = File.read(package_spec_path + '/rhel.json') 307 end 308 else # assume debian 309 package_spec_file_path = File.read(package_spec_path + '/debian.json') 310 end 311 312 package_spec = JSON.parse(package_spec_file_path) 313 packages = package_spec['samba_packages'] + package_spec['samba_deps'] + package_spec['proxyfs_packages'] + package_spec['nfs_packages'] + package_spec['gdb_packages'] + package_spec['utils_packages'] 314 packages += package_spec['wireshark_packages'] if is_dev 315 packages += package_spec['ssh_packages'] if is_dev 316 317 packages.each do |pkg| 318 if pkg.size >= 2 319 # Specify a version if it's been provided 320 package pkg[0] do 321 action :install 322 version pkg[1] 323 end 324 else 325 # Just install whatever YUM provides otherwise 326 package pkg[0] do 327 action :install 328 end 329 end 330 end 331 332 if is_dev 333 group 'wireshark' do 334 action :create 335 members [proxyfs_user] 336 end 337 338 file '/usr/bin/dumpcap' do 339 group 'wireshark' 340 end 341 342 execute 'setcap' do 343 command "setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap" 344 end 345 end 346 347 # 348 # Always remake the samba symbolic link since the user may be switching between 349 # Centos and Ubuntu 350 # 351 execute "Remove samba symbolic link" do 352 command "rm -f samba" 353 cwd SAMBA_PARENT_DIR 354 end 355 356 357 # 358 # Check out and build samba 359 # 360 # For now we're hard-coding the OS. It should be parametrized. 361 OS_DISTRO="centos" 362 OS_DISTRO_VERSION="7.5" 363 364 SAMBA_VERSION = ss_packages ? "4.6.2" : "" 365 366 bash 'Check out samba + build headers if needed' do 367 code <<-EOH 368 if [ "#{SAMBA_VERSION}" = "" ]; then 369 SAMBA_VERSION="`smbstatus -V | cut -d' ' -f2 | tr -d '\\n'`" 370 else 371 SAMBA_VERSION="#{SAMBA_VERSION}" 372 fi 373 SAMBA_DIR="build-samba-`echo ${SAMBA_VERSION} | sed -e 's:\\.:-:g'`-#{OS_DISTRO}-#{OS_DISTRO_VERSION.gsub(".", "-")}" 374 375 if [ -d "#{SAMBA_PARENT_DIR}/${SAMBA_DIR}" ]; then 376 ln -s ${SAMBA_DIR} #{SAMBA_SRC_DIR} 377 else 378 # Check out samba 379 git clone -b samba-${SAMBA_VERSION} --single-branch --depth 1 https://github.com/samba-team/samba.git ${SAMBA_DIR} 380 381 ln -s ${SAMBA_DIR} #{SAMBA_SRC_DIR} 382 383 cd #{SAMBA_SRC_DIR} 384 385 # Configure samba src 386 # lockfile dropped by `waf configure` 387 if [ ! -f "#{SAMBA_SRC_DIR}/.lock-wscript" ]; then 388 ./configure 389 fi 390 391 # Build samba headers 392 if [ ! -f "#{SAMBA_SRC_DIR}/bin/default/librpc/gen_ndr/server_id.h" ]; then 393 make GEN_NDR_TABLES 394 fi 395 fi 396 EOH 397 cwd SAMBA_PARENT_DIR 398 end 399 400 # 401 # Configure Samba 402 # 403 404 if ss_packages 405 smb_conf = "/opt/ss/etc/samba/smb.conf" 406 else 407 smb_conf = "/etc/samba/smb.conf" 408 end 409 410 execute "Setup #{smb_conf}" do 411 command "cat sample_entry_smb_conf.txt > #{smb_conf}" 412 cwd "#{VFS_SRC_DIR}" 413 end 414 415 ruby_block "update_smb_conf" do 416 block do 417 file = Chef::Util::FileEdit.new(smb_conf) 418 file.search_file_replace(/valid users = CHANGEME/, "valid users = #{node['swift_user']}") 419 file.write_file 420 end 421 end 422 423 smbpasswd_path = ss_packages ? "/opt/ss/bin/smbpasswd" : "/bin/smbpasswd" 424 execute "Setup Samba password" do 425 command "printf \"#{node['swift_user']}\n#{node['swift_user']}\n\" | #{smbpasswd_path} -a -s #{node['swift_user']}" 426 end 427 428 # 429 # Create mount point and fstab entry 430 # 431 execute "Create SMB mount point" do 432 command "mkdir /mnt/smb_proxyfs_mount" 433 not_if { ::Dir.exists?("/mnt/smb_proxyfs_mount") } 434 end 435 436 execute "Create NFS mount point" do 437 command "mkdir /mnt/nfs_proxyfs_mount" 438 not_if { ::Dir.exists?("/mnt/nfs_proxyfs_mount") } 439 end 440 441 execute "Create PFSAgent mount point" do 442 command "mkdir /mnt/pfsa_proxyfs_mount" 443 not_if { ::Dir.exists?("/mnt/pfsa_proxyfs_mount") } 444 end 445 446 ruby_block "Create exports entry" do 447 block do 448 unless File.exist?("/etc/exports") 449 File.open("/etc/exports", "w") do |fh| 450 # nothing to do here, just making an empty file 451 end 452 end 453 454 editor = Chef::Util::FileEdit.new("/etc/exports") 455 editor.insert_line_if_no_match("CommonMountPoint", "/CommonMountPoint 127.0.0.1(rw,sync,fsid=1000,no_subtree_check,no_root_squash)") 456 editor.write_file 457 end 458 end 459 460 # 461 # Enable user processes to do FUSE stuff 462 # 463 bash 'Enable UserMode FUSE' do 464 code <<-EOH 465 chmod +x /bin/fusermount 466 echo "user_allow_other" > /etc/fuse.conf 467 EOH 468 end 469 470 # 471 # Build and install proxyfs 472 # 473 474 # TODO: this not_if is incorrect, especially now that the same source tree can 475 # target centos or ubuntu. We should check for the existence of the link 476 # below at the very least. 477 bash 'Build proxyfsd' do 478 # Source profile because we may not have golang in our path yet 479 code <<-EOH 480 . #{DOT_BASH_PROFILE} 481 make clean minimal 482 EOH 483 cwd PROXYFS_SRC_DIR 484 end 485 486 ## TODO: If this link/file does not exist, we should rebuild everything 487 ## TODO: do this as an install instead, for non dev environments? 488 link '/usr/bin/proxyfsd' do 489 to "#{source_root}/bin/proxyfsd" 490 link_type :symbolic 491 owner proxyfs_user 492 group proxyfs_group 493 end 494 495 link '/usr/bin/pfsagentd' do 496 to "#{source_root}/bin/pfsagentd" 497 link_type :symbolic 498 owner proxyfs_user 499 group proxyfs_group 500 end 501 502 link '/usr/bin/pfsagentd-swift-auth-plugin' do 503 to "#{source_root}/bin/pfsagentd-swift-auth-plugin" 504 link_type :symbolic 505 owner proxyfs_user 506 group proxyfs_group 507 end 508 509 if ss_packages 510 # Creating link to jrpcclient's libs into the new /opt/ss path 511 link '/opt/ss/lib64/libproxyfs.so.1.0.0' do 512 to "#{JRPCCLIENT_SRC_DIR}/libproxyfs.so.1.0.0" 513 link_type :symbolic 514 owner "root" 515 group "root" 516 end 517 518 link '/opt/ss/lib64/libproxyfs.so.1' do 519 to "#{JRPCCLIENT_SRC_DIR}/libproxyfs.so.1.0.0" 520 link_type :symbolic 521 owner "root" 522 group "root" 523 end 524 525 link '/opt/ss/lib64/libproxyfs.so' do 526 to "#{JRPCCLIENT_SRC_DIR}/libproxyfs.so.1.0.0" 527 link_type :symbolic 528 owner "root" 529 group "root" 530 end 531 532 # Creating link to vfs' libs into the new /opt/ss path 533 directory '/opt/ss/lib64/samba/vfs' do 534 owner 'root' 535 group 'root' 536 mode '0755' 537 action :create 538 end 539 540 link '/opt/ss/lib64/samba/vfs/proxyfs.so' do 541 to "#{VFS_SRC_DIR}/proxyfs.so" 542 link_type :symbolic 543 owner "root" 544 group "root" 545 mode '0755' 546 end 547 end 548 549 cookbook_file "#{HOME_DIR}/.gdbinit" do 550 source "home/unprivileged_user/.gdbinit" 551 owner "#{proxyfs_user}" 552 group "#{proxyfs_group}" 553 end 554 555 template "/root/.gdbinit" do 556 source "root/.gdbinit.erb" 557 owner "root" 558 group "root" 559 variables({ 560 :proxyfs_user => "#{proxyfs_user}" 561 }) 562 end 563 564 bash 'Configure awscli for swift user' do 565 code <<-EOH 566 mkdir ~swift/.aws 567 cat > ~swift/.aws/config << EOF 568 [plugins] 569 endpoint = awscli_plugin_endpoint 570 571 [default] 572 s3 = 573 endpoint_url = http://127.0.0.1:8080 574 multipart_threshold = 64MB 575 multipart_chunksize = 16MB 576 s3api = 577 endpoint_url = http://127.0.0.1:8080 578 multipart_threshold = 64MB 579 multipart_chunksize = 16MB 580 581 [profile nfspfs] 582 s3 = 583 endpoint_url = http://127.0.0.1:8080 584 multipart_threshold = 64MB 585 multipart_chunksize = 16MB 586 s3api = 587 endpoint_url = http://127.0.0.1:8080 588 multipart_threshold = 64MB 589 multipart_chunksize = 16MB 590 591 [profile smbpfs] 592 s3 = 593 endpoint_url = http://127.0.0.1:8080 594 multipart_threshold = 64MB 595 multipart_chunksize = 16MB 596 s3api = 597 endpoint_url = http://127.0.0.1:8080 598 multipart_threshold = 64MB 599 multipart_chunksize = 16MB 600 601 [profile pfsapfs] 602 s3 = 603 endpoint_url = http://127.0.0.1:8080 604 multipart_threshold = 64MB 605 multipart_chunksize = 16MB 606 s3api = 607 endpoint_url = http://127.0.0.1:8080 608 multipart_threshold = 64MB 609 multipart_chunksize = 16MB 610 EOF 611 cat > ~swift/.aws/credentials << EOF 612 [default] 613 aws_access_key_id = test:tester 614 aws_secret_access_key = testing 615 616 [nfspfs] 617 aws_access_key_id = test:tester 618 aws_secret_access_key = testing 619 620 [smbpfs] 621 aws_access_key_id = test:tester 622 aws_secret_access_key = testing 623 624 [pfsapfs] 625 aws_access_key_id = test:tester 626 aws_secret_access_key = testing 627 EOF 628 chown -R swift:swift ~swift/.aws 629 EOH 630 end 631 632 bash 'Configure awscli for root user' do 633 code <<-EOH 634 mkdir ~root/.aws 635 cat > ~root/.aws/config << EOF 636 [plugins] 637 endpoint = awscli_plugin_endpoint 638 639 [default] 640 s3 = 641 endpoint_url = http://127.0.0.1:8080 642 multipart_threshold = 64MB 643 multipart_chunksize = 16MB 644 s3api = 645 endpoint_url = http://127.0.0.1:8080 646 multipart_threshold = 64MB 647 multipart_chunksize = 16MB 648 649 [profile nfspfs] 650 s3 = 651 endpoint_url = http://127.0.0.1:8080 652 multipart_threshold = 64MB 653 multipart_chunksize = 16MB 654 s3api = 655 endpoint_url = http://127.0.0.1:8080 656 multipart_threshold = 64MB 657 multipart_chunksize = 16MB 658 659 [profile smbpfs] 660 s3 = 661 endpoint_url = http://127.0.0.1:8080 662 multipart_threshold = 64MB 663 multipart_chunksize = 16MB 664 s3api = 665 endpoint_url = http://127.0.0.1:8080 666 multipart_threshold = 64MB 667 multipart_chunksize = 16MB 668 669 [profile pfsapfs] 670 s3 = 671 endpoint_url = http://127.0.0.1:8080 672 multipart_threshold = 64MB 673 multipart_chunksize = 16MB 674 s3api = 675 endpoint_url = http://127.0.0.1:8080 676 multipart_threshold = 64MB 677 multipart_chunksize = 16MB 678 EOF 679 cat > ~root/.aws/credentials << EOF 680 [default] 681 aws_access_key_id = test:tester 682 aws_secret_access_key = testing 683 684 [nfspfs] 685 aws_access_key_id = test:tester 686 aws_secret_access_key = testing 687 688 [smbpfs] 689 aws_access_key_id = test:tester 690 aws_secret_access_key = testing 691 692 [pfsapfs] 693 aws_access_key_id = test:tester 694 aws_secret_access_key = testing 695 EOF 696 chown -R root:root ~root/.aws 697 EOH 698 end 699 700 execute 'set up s3api' do 701 command "/usr/bin/set_up_s3api" 702 end 703 704 execute 'set up swift3' do 705 command "/usr/bin/set_up_swift3" 706 end 707 708 execute 'enable s3api' do 709 command "/usr/bin/enable_s3 s3api" 710 end