2 # Cookbook Name:: kata-containers
5 # Copyright 2018, whitestar
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
20 platform = node['platform']
23 when 'centos', 'redhat'
27 resources(package: pkg_name) rescue package pkg_name do
32 bash 'add_kata-containers_repo' do
34 source /etc/os-release
35 yum-config-manager --add-repo "http://download.opensuse.org/repositories/home:/katacontainers:/release/CentOS_${VERSION_ID}/home:katacontainers:release.repo"
38 not_if "yum repolist | grep 'katacontainers'"
46 resources(package: pkg_name) rescue package pkg_name do
48 notifies :run, 'bash[add_kata-containers_repo]', :before
52 apt_get_update = 'apt-get_update'
53 resources(execute: apt_get_update) rescue execute apt_get_update do
54 command 'apt-get update'
58 bash 'add_kata-containers_apt_key' do
60 curl -sL http://download.opensuse.org/repositories/home:/katacontainers:/release/xUbuntu_$(lsb_release -rs)/Release.key | apt-key add -
63 not_if "apt-key list | grep 'katacontainers'"
66 bash 'add_kata-containers_apt_line' do
68 echo "deb http://download.opensuse.org/repositories/home:/katacontainers:/release/xUbuntu_$(lsb_release -rs)/ /" > /etc/apt/sources.list.d/kata-containers.list
71 not_if { File.exist?('/etc/apt/sources.list.d/kata-containers.list') }
72 notifies :run, 'bash[add_kata-containers_apt_key]', :before
73 notifies :run, "execute[#{apt_get_update}]", :immediately
81 resources(package: pkg_name) rescue package pkg_name do
83 notifies :run, 'bash[add_kata-containers_apt_line]', :before