diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..48717e5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +--- +name: ci + +"on": + pull_request: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get -y install build-essential autoconf dump kpartx fdisk qemu-utils + - name: Build + run: | + ./autogen.sh + ./configure + make + sudo make install diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index ac8ba98..0000000 --- a/.rubocop.yml +++ /dev/null @@ -1,28 +0,0 @@ -AllCops: - Include: - - '**/Berksfile' - - '**/Cheffile' - Exclude: - - 'metadata.rb' - - 'cookbooks/**/*' - -Style/NumericLiteralPrefix: - EnforcedOctalStyle: zero_only - -Metrics/LineLength: - Max: 120 - -Metrics/AbcSize: - Max: 30 - -Metrics/MethodLength: - Max: 100 - -Style/IfUnlessModifier: - MaxLineLength: 120 - -Style/WhileUntilModifier: - MaxLineLength: 120 - -Metrics/BlockLength: - Enabled: false diff --git a/Vagrantfile b/Vagrantfile index c673903..712dc9d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,23 +7,29 @@ Vagrant.require_version '>= 1.7.0' Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| %w( - centos-6.9 - centos-7.3 - debian-8.8 - debian-9.0 - ubuntu-12.04 - ubuntu-14.04 - ubuntu-16.04 + almalinux-8 + almalinux-9 + centos-7 + debian-10 + debian-11 + ubuntu-18.04 + ubuntu-20.04 + ubuntu-22.04 ).each do |os| config.vm.define os do |node| node.vm.hostname = 'instance-image.localdomain' node.vm.box = "bento/#{os}" node.vm.network :private_network, ip: '192.168.10.11' + node.vm.provider 'virtualbox' do |v| + v.memory = 2048 + v.cpus = 2 + end node.vm.provision :chef_solo do |chef| - chef.version = '12.18.31' + chef.version = '17' + chef.install = true chef.cookbooks_path = 'cookbooks' + chef.binary_env = 'CHEF_LICENSE=accept-no-persist' chef.run_list = %w( - recipe[apt] recipe[instance-image-devel] recipe[instance-image-devel::install] recipe[instance-image-devel::variants] diff --git a/cloud_init.rb b/cloud_init.rb index 1a701bc..e24df39 100755 --- a/cloud_init.rb +++ b/cloud_init.rb @@ -68,7 +68,6 @@ def cloud_init 'instance-id' => host, 'disable_root' => disable_root, 'ssh_pwauth' => ssh_pwauth, - 'datasource_list' => %w(None), 'manage-resolv-conf' => manage_conf, 'manage_resolv_conf' => manage_conf, 'cloud_init_modules' => init_modules, diff --git a/test/cookbooks/instance-image-devel/metadata.rb b/test/cookbooks/instance-image-devel/metadata.rb index b6771d4..6aefde5 100644 --- a/test/cookbooks/instance-image-devel/metadata.rb +++ b/test/cookbooks/instance-image-devel/metadata.rb @@ -1,10 +1,8 @@ name 'instance-image-devel' maintainer 'Oregon State University' maintainer_email 'chef@osuosl.org' -license 'Apache 2.0' +license 'Apache-2.0' description 'Installs/Configures instance-image-devel' -long_description '' version '0.1.0' -depends 'build-essential' depends 'ganeti' -depends 'yum-centos' +depends 'line' diff --git a/test/cookbooks/instance-image-devel/recipes/default.rb b/test/cookbooks/instance-image-devel/recipes/default.rb index 0ab0b36..f6a552b 100644 --- a/test/cookbooks/instance-image-devel/recipes/default.rb +++ b/test/cookbooks/instance-image-devel/recipes/default.rb @@ -1,63 +1,35 @@ -netdev = - case node['platform_family'] - when 'rhel' - if node['platform_version'].to_i < 7 - 'eth1' - else - 'enp0s8' - end - when 'debian' - case node['platform'] - when 'debian' - if node['platform_version'].to_i < 9 - 'eth1' - else - 'enp0s8' - end - when 'ubuntu' - if node['platform_version'].to_i < 16 - 'eth1' - else - 'enp0s8' - end - end - end -node.default['yum']['base']['baseurl'] = 'http://centos.osuosl.org/$releasever/os/$basearch' -node.default['yum']['updates']['baseurl'] = 'http://centos.osuosl.org/$releasever/updates/$basearch/' -node.default['yum']['extras']['baseurl'] = 'http://centos.osuosl.org/$releasever/extras/$basearch/' -node.default['yum']['epel']['baseurl'] = "http://epel.osuosl.org/#{node['platform_version'].to_i}/$basearch" +# node.default['ganeti']['version'] = '2.16.2' +node.default['ganeti']['yum']['url'] = 'https://ftp2.osuosl.org/pub/ganeti-rpm/$releasever/$basearch' node.default['ganeti']['master-node'] = 'instance-image.localdomain' node.default['ganeti']['instance_image']['variants_list'] = %w(default cirros) node.default['ganeti']['instance_image']['config_defaults']['image_debug'] = 1 node.default['ganeti']['instance_image']['config_defaults']['swap'] = 'no' node.default['ganeti']['instance_image']['config_defaults']['cache_dir'] = '' node.default['ganeti']['cluster'].tap do |c| - c['master-netdev'] = netdev + c['master-netdev'] = 'eth1' c['disk-templates'] = %w(plain) c['nic'] = { 'mode' => 'routed', - 'link' => '100' + 'link' => '100', } c['extra-opts'] = [ '--vg-name=ganeti', - "-H kvm:kernel_path='',initrd_path=''" + "-H kvm:kernel_path='',initrd_path=''", ].join(' ') c['name'] = 'ganeti.localdomain' end -include_recipe 'yum-centos' if platform_family?('rhel') -include_recipe 'build-essential' +build_essential 'ganeti-instance-image' -%w( +package %w( automake curl dump kpartx + lvm2 parted vim -).each do |p| - package p -end +) execute 'create ganeti volume group' do command <<-EOF @@ -68,22 +40,29 @@ not_if 'vgs ganeti' end -hostsfile_entry '127.0.0.1' do - hostname 'localhost' - aliases %w(localhost.localdomain localhost4 localhost4.localdomain4) - action :create +replace_or_add 'localhost' do + path '/etc/hosts' + pattern /^127.0.0.1.*/ + sensitive false + line '127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4' +end + +delete_lines 'remove 127.0.1.1' do + path '/etc/hosts' + pattern /^127.0.1.1.*/ + sensitive false end -hostsfile_entry '192.168.10.10' do - hostname 'ganeti.localdomain' - action :create +append_if_no_line '192.168.10.10' do + path '/etc/hosts' + sensitive false + line '192.168.10.10 ganeti.localdomain' end -hostsfile_entry node['network']['interfaces'][netdev]['addresses'].keys[1] do - hostname node['fqdn'] - aliases [node['hostname']] - unique true - action :create +append_if_no_line 'hostname' do + path '/etc/hosts' + sensitive false + line "#{node['network']['interfaces']['eth1']['addresses'].keys[1]} #{node['fqdn']} #{node['hostname']}" end include_recipe 'ganeti' diff --git a/test/cookbooks/instance-image-devel/recipes/install.rb b/test/cookbooks/instance-image-devel/recipes/install.rb index 2883543..ee45f47 100644 --- a/test/cookbooks/instance-image-devel/recipes/install.rb +++ b/test/cookbooks/instance-image-devel/recipes/install.rb @@ -14,5 +14,4 @@ delete_resource(:yum_repository, 'ganeti-instance-image') delete_resource(:apt_repository, 'ganeti-instance-image') -delete_resource(:yum_package, 'ganeti-instance-image') -delete_resource(:apt_package, 'ganeti-instance-image') +delete_resource(:package, 'ganeti-instance-image')