_podman.rb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #
  2. # Cookbook:: workstation
  3. # Recipe:: _podman
  4. #
  5. # Copyright:: 2022, The Authors, All Rights Reserved.
  6. apt_repository 'devel_kubic_libcontainer_stable' do
  7. arch 'amd64'
  8. uri 'http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_11/'
  9. distribution '/'
  10. deb_src true
  11. action :add
  12. end
  13. remote_file ::File.join(Chef::Config['file_cache_path'], 'devel_kubic_libcontainer_stable.key') do
  14. source 'https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_Unstable/Release.key'
  15. action :create_if_missing
  16. end
  17. key_path = '/etc/apt/trusted.gpg.d'
  18. key_stable = ::File.join(key_path, 'devel_kubic_libcontainers_stable.gpg')
  19. execute 'GPG key for devel_kubic_libcontainer_stable' do
  20. command "cat #{::File.join(Chef::Config['file_cache_path'], 'devel_kubic_libcontainer_stable.key')} | gpg --dearmor | tee #{key_stable} > /dev/null"
  21. not_if { ::File.exist?(key_stable) }
  22. end
  23. package ['uidmap', 'fuse-overlayfs', 'containernetworking-plugins', 'slirp4netns', 'buildah']
  24. # Specific to WSL2:
  25. # Ref: https://www.redhat.com/sysadmin/podman-windows-wsl2
  26. #
  27. directory '/etc/containers/containers.conf.d' do
  28. owner 'root'
  29. group 'root'
  30. mode '0755'
  31. action :create
  32. end
  33. file '/etc/containers/containers.conf.d/99wsl2.conf' do
  34. owner 'root'
  35. group 'root'
  36. mode '0755'
  37. content <<~_WSL2
  38. [engine]
  39. cgroup_manager = "cgroupfs"
  40. events_logger = "file"
  41. _WSL2
  42. action :create
  43. end