4

im new to foreman and puppet. I'm not sure what I changed but now my provisioning templates aren't running.

Ubuntu installation fails with exit code 8 with the following screen:

enter image description here

i found out that URL is defined in the Preseed default template:

<%#
kind: provision
name: Preseed default
oses:
- Debian 6.0
- Debian 7.0
- Ubuntu 10.04
- Ubuntu 12.04
- Ubuntu 13.04
- Ubuntu 14.04
%>
<%
  # safemode renderer does not support unary negation
  pm_set = @host.puppetmaster.empty? ? false : true
  puppet_enabled = pm_set || @host.params['force-puppet']
%>
# Locale, country and keyboard settings
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i console-setup/modelcode string pc105
d-i console-setup/variant USA
d-i console-setup/layout USA
d-i console-setup/layoutcode string us

<% if @host.operatingsystem.name == 'Debian' && @host.operatingsystem.major.to_i >= 7 -%>
d-i keymap select us
<% end -%>

<% if @static -%>
# Static network configuration.
d-i netcfg/disable_dhcp boolean true
d-i netcfg/get_ipaddress string <%= @host.ip %>
d-i netcfg/get_netmask string <%= @host.subnet.mask %>
d-i netcfg/get_nameservers string <%= [@host.subnet.dns_primary,@host.subnet.dns_secondary].reject{|n| n.blank?}.join(' ') %>
d-i netcfg/get_gateway string <%= @host.subnet.gateway %>
d-i netcfg/confirm_static boolean true
<% end -%>

# Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string <%= @host %>
d-i netcfg/get_domain string <%= @host.domain %>
d-i netcfg/wireless_wep string

d-i hw-detect/load_firmware boolean true

# Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string <%= @preseed_server %>
d-i mirror/http/directory string <%= @preseed_path %>
d-i mirror/http/proxy string
d-i mirror/codename string <%= @host.operatingsystem.release_name %>
d-i mirror/suite string <%= @host.operatingsystem.release_name %>
d-i mirror/udeb/suite string <%= @host.operatingsystem.release_name %>

# Time settings
d-i clock-setup/utc boolean true
d-i time/zone string <%= @host.params['time-zone'] || 'UTC' %>

# NTP
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string <%= @host.params['ntp-server'] || '0.debian.pool.ntp.org' %>

# Set alignment for automatic partitioning
# Choices: cylinder, minimal, optimal
#d-i partman/alignment select cylinder

<%= @host.diskLayout %>

# Install different kernel
#d-i base-installer/kernel/image string linux-server

# User settings
d-i passwd/root-password-crypted password <%= root_pass %>
user-setup-udeb passwd/root-login boolean true
d-i passwd passwd/make-user boolean false
user-setup-udeb passwd/make-user boolean false

<% if puppet_enabled && @host.params['enable-puppetlabs-repo'] && @host.params['enable-puppetlabs-repo'] == 'true' -%>
# Puppetlabs products
d-i apt-setup/local0/repository string \
      http://apt.puppetlabs.com <%= @host.operatingsystem.release_name %> main
d-i apt-setup/local0/comment string Puppetlabs products
d-i apt-setup/local0/source boolean true
d-i apt-setup/local0/key string http://apt.puppetlabs.com/pubkey.gpg
# Puppetlabs dependencies
d-i apt-setup/local1/repository string \
      http://apt.puppetlabs.com <%= @host.operatingsystem.release_name %> dependencies
d-i apt-setup/local1/comment string Puppetlabs dependencies
d-i apt-setup/local1/source boolean true
d-i apt-setup/local1/key string http://apt.puppetlabs.com/pubkey.gpg
<% end -%>

# Install minimal task set (see tasksel --task-packages minimal)
tasksel tasksel/first multiselect minimal

<% if puppet_enabled %>
  <% if @host.operatingsystem.name == 'Ubuntu' and @host.operatingsystem.major.to_i == 10 -%>
    <% puppet_package = 'puppet/lucid-backports' -%>
d-i apt-setup/backports boolean true
  <% else -%>
    <% puppet_package = 'puppet' -%>
  <% end -%>
<% else -%>
  <% puppet_package = '' -%>
<% end -%>

# Install some base packages
d-i pkgsel/include string <%= puppet_package %> lsb-release openssh-server
d-i pkgsel/update-policy select unattended-upgrades

popularity-contest popularity-contest/participate boolean false

# Boot loader settings
#grub-pc grub-pc/hidden_timeout boolean false
#grub-pc grub-pc/timeout string 10
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true

d-i finish-install/reboot_in_progress note

d-i preseed/late_command string wget <%= foreman_url('finish') %> -O /target/tmp/finish.sh && in-target chmod +x /tmp/finish.sh && in-target /tmp/finish.sh

I looked at /var/log/foreman/production.log and i see the get request and the logs for it are:

Started GET "/unattended/finish?token=2df48ae2-c67b-4e40-883a-91c397bb8bed" for 192.168.20.127 at 2014-09-10 18:19:27 -0700
Processing by UnattendedController#finish as */*
  Parameters: {"token"=>"2df48ae2-c67b-4e40-883a-91c397bb8bed"}
Found mon01.prod.devita.co
  Rendered inline template (20.3ms)
Completed 200 OK in 51.8ms (Views: 20.2ms | ActiveRecord: 22.7ms)
Started GET "/node/mon01.prod.devita.co?format=yml" for 127.0.0.1 at 2014-09-10 18:19:30 -0700
Processing by HostsController#externalNodes as YML
  Parameters: {"name"=>"mon01.prod.devita.co"}
  Rendered text template (0.0ms)
Completed 200 OK in 52.4ms (Views: 0.6ms | ActiveRecord: 8.2ms)
Started POST "/api/hosts/facts" for 127.0.0.1 at 2014-09-10 18:19:31 -0700
Processing by Api::V2::HostsController#facts as JSON
  Parameters: {"facts"=>"[FILTERED]", "name"=>"mon01.devita.co", "certname"=>"mon01.prod.devita.co", "apiv"=>"v2", "host"=>{"facts"=>"[FILTERED]", "name"=>"mon01.devita.co", "certname"=>"mon01.prod.devita.co"}}
Import facts for 'mon01.devita.co' completed. Added: 87, Updated: 0, Deleted 0 facts
Completed 201 Created in 1087.2ms (Views: 40.6ms | ActiveRecord: 0.0ms)
Started GET "/node/mon01.prod.devita.co?format=yml" for 127.0.0.1 at 2014-09-10 18:19:32 -0700
Processing by HostsController#externalNodes as YML
  Parameters: {"name"=>"mon01.prod.devita.co"}
  Rendered text template (0.0ms)
Completed 200 OK in 30.5ms (Views: 0.6ms | ActiveRecord: 5.2ms)
Started POST "/api/reports" for 127.0.0.1 at 2014-09-10 18:19:33 -0700
Processing by Api::V2::ReportsController#create as JSON
  Parameters: {"report"=>"[FILTERED]", "apiv"=>"v2"}
processing report for mon01.prod.devita.co
Imported report for mon01.prod.devita.co in 0.05 seconds
Completed 201 Created in 60.1ms (Views: 2.6ms | ActiveRecord: 0.0ms)
Started GET "/unattended/built?token=2df48ae2-c67b-4e40-883a-91c397bb8bed" for 192.168.20.127 at 2014-09-10 18:19:33 -0700
Processing by UnattendedController#built as */*
  Parameters: {"token"=>"2df48ae2-c67b-4e40-883a-91c397bb8bed"}
Found mon01.prod.devita.co
unattended: mon01.prod.devita.co is Built!
Completed 409 Conflict in 256.7ms (ActiveRecord: 8.7ms)
3
  • I am having the same error also, any luck finding the issue?
    – Mark S.
    Oct 1, 2014 at 15:53
  • It would be relevant to attach your finish script
    – dhojgaard
    Jan 14, 2015 at 7:57
  • Worth noting is that this applies to Ubuntu/Debian only. The preseed script is set to only run on those distros. Still trying to figure out if/how finish scripts run on Red Hat/CentOS, but is definitely different. Jun 22, 2016 at 17:40

2 Answers 2

1

This normally happens if a former build failed and you try to build the machine again - even if it's in build mode. The simplest way to solve this problem is to delete and recreate the machine in Foreman.

1
  • Yep, also watch for token_duration setting, they can expire.
    – lzap
    Jan 16, 2017 at 9:02
0

You should try the following: d-i preseed/late_command string in-target wget <%= foreman_url('finish') %> -O /target/tmp/finish.sh ; in-target chmod +x /tmp/finish.sh ; in-target /tmp/finish.sh

Worked for me. In addition while trying to solve it, I saved the file under / and made sure it's there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .