Skip to content

Commit

Permalink
Merge pull request #31 from osuosl/ramereth/datasource
Browse files Browse the repository at this point in the history
Remove datasource_list from generated cloud-init config
  • Loading branch information
ramereth authored Apr 27, 2023
2 parents 9e1d323 + 14f9585 commit a85949a
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 93 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 0 additions & 28 deletions .rubocop.yml

This file was deleted.

24 changes: 15 additions & 9 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 0 additions & 1 deletion cloud_init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 2 additions & 4 deletions test/cookbooks/instance-image-devel/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name 'instance-image-devel'
maintainer 'Oregon State University'
maintainer_email '[email protected]'
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'
77 changes: 28 additions & 49 deletions test/cookbooks/instance-image-devel/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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'
3 changes: 1 addition & 2 deletions test/cookbooks/instance-image-devel/recipes/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit a85949a

Please sign in to comment.