Skip to content

Commit 37d94de

Browse files
committed
update debian preseed files
- generate puppet.conf, rather than downloading from fileserver - set environment to match vmhost - new `puppetserver` parameter sets puppet server address - remove packages from preseed: - dirmngr: not needed, probably leftover from adding puppetlabs deb - openssh-server: installed on first puppet run - iptables-persistent - installed on first puppet run - not needed w/o ssh - removing this removes the need to download iptables config - qemu-guest-agent: install from main pkgset, not late_command
1 parent 962a610 commit 37d94de

7 files changed

Lines changed: 32 additions & 38 deletions

File tree

manifests/profile/vmhost/host.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Integer $disk,
2121
Integer $ram,
2222
String $domain,
23-
String $filehost,
23+
String $puppetserver,
2424
String $image_dir,
2525
String $net_interface,
2626
String $netmask,
@@ -74,7 +74,7 @@
7474
disk => $disk,
7575
ram => $ram,
7676
domain => $domain,
77-
filehost => $filehost,
77+
puppetserver => $puppetserver,
7878
image_dir => $image_dir,
7979
net_interface => $net_interface,
8080
internet_bridge => $internet_bridge,

manifests/virtual_machine.pp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
# @param gateway Preseed IPv4 gateway
2222
# @param nameservers Preseed IPv4 nameservers
2323
# @param domain Domain to enter in the preseed file
24-
# @param filehost URL to find preseed files puppetlabs-pc1-keyring.gpg
25-
# and puppet.conf
24+
# @param puppetserver hostname of puppet server
2625
# @param timeout Number of seconds to wait for the VM to install before
2726
# giving up
2827
#
@@ -41,7 +40,7 @@
4140
# nebula::virtual_machine { 'supergood':
4241
# $addr => '2.4.6.8',
4342
# $domain => 'awesome.com',
44-
# $filehost => 'preseedfiles.awesome.com',
43+
# $puppetserver => 'puppetserver.awesome.com',
4544
# }
4645
#
4746
# @example Declaring a VM that may take up to 20 minutes to install
@@ -74,7 +73,7 @@
7473
String $lan_bridge = 'br1',
7574
Array $nameservers = ['192.168.1.1'],
7675
String $domain = 'default.invalid',
77-
String $filehost = 'files.default.invalid',
76+
String $puppetserver = 'puppet',
7877
Integer $timeout = 600,
7978
) {
8079
require nebula::profile::vmhost::prereqs

spec/classes/profile/vmhost/host_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def contain_vm(name)
5555
it { is_expected.to contain_vm("vmname").with_disk(0) }
5656
it { is_expected.to contain_vm("vmname").with_ram(0) }
5757
it { is_expected.to contain_vm("vmname").with_domain("default.domain.invalid") }
58-
it { is_expected.to contain_vm("vmname").with_filehost("default.filehost.invalid") }
58+
it { is_expected.to contain_vm("vmname").with_puppetserver("default.puppetserver.invalid") }
5959
it { is_expected.to contain_vm("vmname").with_image_dir("default.image_dir.invalid") }
6060
it { is_expected.to contain_vm("vmname").with_net_interface("default.iface.invalid") }
6161
it { is_expected.to contain_vm("vmname").with_internet_bridge("br0") }
@@ -92,11 +92,11 @@ def contain_vm(name)
9292
it { is_expected.to contain_vm("vmname").with_domain(domain) }
9393
end
9494

95-
context "with a random filehost" do
95+
context "with a random puppetserver" do
9696
let(:domain) { Faker::Internet.domain_name }
97-
let(:params) { super().merge(filehost: domain) }
97+
let(:params) { super().merge(puppetserver: domain) }
9898

99-
it { is_expected.to contain_vm("vmname").with_filehost(domain) }
99+
it { is_expected.to contain_vm("vmname").with_puppetserver(domain) }
100100
end
101101

102102
context "with a net_interface of eth3" do

spec/defines/virtual_machine_spec.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,22 @@ def contain_preseed
4848
%r{^d-i netcfg/get_domain string default\.invalid$},
4949
%r{^d-i netcfg/hostname string vmname\.default\.invalid$},
5050
%r{^d-i apt-setup/local0/repository string https://apt\.voxpupuli\.org debian13 openvox8$.*^d-i apt-setup/local0/key string https://apt\.voxpupuli\.org/openvox-keyring\.gpg$}m,
51-
%r{\swget -O /target/etc/puppetlabs/puppet/puppet\.conf\s.*https://files\.default\.invalid/puppet\.conf}m
51+
%r{/etc/puppetlabs/puppet/puppet\.conf},
52+
/server = puppet/,
53+
/environment = rp_env/
5254
].each do |line|
5355
it { is_expected.to contain_preseed.with_content(line) }
5456
end
5557

58+
it "preseed does not use a fileserver" do
59+
is_expected.not_to contain_preseed.with_content(/(curl|wget)/)
60+
end
61+
62+
it "preseed does not configure iptables" do
63+
is_expected.not_to contain_preseed.with_content(/(iptables|netfilter)-persistent/)
64+
is_expected.not_to contain_preseed.with_content(/iptables/)
65+
end
66+
5667
it do
5768
expect(subject).to contain_package("virtinst").with(
5869
ensure: "installed"

spec/fixtures/hiera/default.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ nebula::profile::vmhost::host::cpus: 0
9797
nebula::profile::vmhost::host::disk: 0
9898
nebula::profile::vmhost::host::ram: 0
9999
nebula::profile::vmhost::host::domain: 'default.domain.invalid'
100-
nebula::profile::vmhost::host::filehost: 'default.filehost.invalid'
100+
nebula::profile::vmhost::host::puppetserver: 'default.puppetserver.invalid'
101101
nebula::profile::vmhost::host::image_dir: 'default.image_dir.invalid'
102102
nebula::profile::vmhost::host::net_interface: 'default.iface.invalid'
103103
nebula::profile::vmhost::host::netmask: '0.0.0.0'

templates/virtual_machine/bookworm.cfg.erb

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -372,14 +372,10 @@ d-i apt-setup/local0/key string https://apt.voxpupuli.org/openvox-keyring.gpg
372372

373373

374374
### Package selection
375-
tasksel tasksel/first multiselect standard, ssh-server
375+
tasksel tasksel/first multiselect standard
376376

377377
# Individual additional packages to install
378-
d-i pkgsel/include string iptables-persistent dirmngr
379-
380-
# Accept defaults for iptables-persistent package
381-
iptables-persistent iptables-persistent/autosave_v4 boolean false
382-
iptables-persistent iptables-persistent/autosave_v6 boolean false
378+
d-i pkgsel/include string qemu-guest-agent
383379

384380
# Whether to upgrade packages after debootstrap.
385381
# Allowed values: none, safe-upgrade, full-upgrade
@@ -484,11 +480,7 @@ d-i finish-install/reboot_in_progress note
484480
d-i preseed/late_command string \
485481
in-target apt-get update -qq; \
486482
in-target apt-get install -qq -y openvox-agent; \
487-
in-target apt-get install -qq -y qemu-guest-agent; \
488483
in-target systemctl enable puppet; \
489-
wget -O /target/etc/puppetlabs/puppet/puppet.conf \
490-
https://<%= @filehost %>/puppet.conf; \
491-
wget -O /target/etc/iptables/rules.v4 \
492-
https://<%= @filehost %>/rules.v4; \
493-
chmod 600 /target/etc/iptables/rules.v4
494-
484+
echo '[agent]' > /target/etc/puppetlabs/puppet/puppet.conf; \
485+
echo 'environment = <%= @environment %>' >> /target/etc/puppetlabs/puppet/puppet.conf; \
486+
echo 'server = <%= @puppetserver %>' >> /target/etc/puppetlabs/puppet/puppet.conf

templates/virtual_machine/trixie.cfg.erb

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -372,14 +372,10 @@ d-i apt-setup/local0/key string https://apt.voxpupuli.org/openvox-keyring.gpg
372372

373373

374374
### Package selection
375-
tasksel tasksel/first multiselect standard, ssh-server
375+
tasksel tasksel/first multiselect standard
376376

377377
# Individual additional packages to install
378-
d-i pkgsel/include string iptables-persistent dirmngr
379-
380-
# Accept defaults for iptables-persistent package
381-
iptables-persistent iptables-persistent/autosave_v4 boolean false
382-
iptables-persistent iptables-persistent/autosave_v6 boolean false
378+
d-i pkgsel/include string qemu-guest-agent
383379

384380
# Whether to upgrade packages after debootstrap.
385381
# Allowed values: none, safe-upgrade, full-upgrade
@@ -484,11 +480,7 @@ d-i finish-install/reboot_in_progress note
484480
d-i preseed/late_command string \
485481
in-target apt-get update -qq; \
486482
in-target apt-get install -qq -y openvox-agent; \
487-
in-target apt-get install -qq -y qemu-guest-agent; \
488483
in-target systemctl enable puppet; \
489-
wget -O /target/etc/puppetlabs/puppet/puppet.conf \
490-
https://<%= @filehost %>/puppet.conf; \
491-
wget -O /target/etc/iptables/rules.v4 \
492-
https://<%= @filehost %>/rules.v4; \
493-
chmod 600 /target/etc/iptables/rules.v4
494-
484+
echo '[agent]' > /target/etc/puppetlabs/puppet/puppet.conf; \
485+
echo 'environment = <%= @environment %>' >> /target/etc/puppetlabs/puppet/puppet.conf; \
486+
echo 'server = <%= @puppetserver %>' >> /target/etc/puppetlabs/puppet/puppet.conf

0 commit comments

Comments
 (0)