diff --git a/manifests/modules/packer/manifests/vsphere.pp b/manifests/modules/packer/manifests/vsphere.pp index eb15a59b9..ff6fc92e8 100644 --- a/manifests/modules/packer/manifests/vsphere.pp +++ b/manifests/modules/packer/manifests/vsphere.pp @@ -49,7 +49,7 @@ file { $startup_file: owner => 'root', group => 'root', - mode => '0755', + mode => pick($startup_file_perms, '0755'), content => template("packer/vsphere/${startup_file_source}"), } diff --git a/manifests/modules/packer/manifests/vsphere/params.pp b/manifests/modules/packer/manifests/vsphere/params.pp index 20dbe25bc..1a53d5c19 100644 --- a/manifests/modules/packer/manifests/vsphere/params.pp +++ b/manifests/modules/packer/manifests/vsphere/params.pp @@ -13,6 +13,7 @@ if $::operatingsystemrelease in ['18.04'] { $startup_file = '/etc/systemd/system/vsphere.bootstrap.service' $startup_file_source = 'vsphere.bootstrap.service' + $startup_file_perms = '0644' } else { $startup_file = '/etc/rc.local' $startup_file_source = 'rc.local' diff --git a/manifests/modules/packer/templates/vsphere/ubuntu.rb.erb b/manifests/modules/packer/templates/vsphere/ubuntu.rb.erb index 06553b172..229ad463d 100644 --- a/manifests/modules/packer/templates/vsphere/ubuntu.rb.erb +++ b/manifests/modules/packer/templates/vsphere/ubuntu.rb.erb @@ -56,12 +56,12 @@ puts '- Cleaning up...' <% if ['18.04'].include? @operatingsystemrelease -%> # With systemd-networkd, disable the oneshot service that runs this script: -Kernel.system('/bin/systemctl disable --now vsphere.bootstrap.service') +Kernel.system('/bin/systemctl disable vsphere.bootstrap.service') <% else -%> # With NetworkManager, /etc/rc.local is what runs this script; Make it a noop after the first run: Kernel.system('echo "exit 0" > /etc/rc.local') <% end -%> puts "\n" - + puts 'Done!'