Problem:
fix_hosts inserted in the kickstart file returns an error
Expected outcome:
Hostname would be set to what is assigned in Foreman
Foreman and Proxy versions:
Foreman 2.1.1
Foreman and Proxy plugin versions:
Distribution and version:
Other relevant data:
I looked at the log files on the installed host in /var/log/anaconda and see the error below. What is wrong with the fix_hosts snippet?
ks-script-jn_rgq_r.log
Too few arguments.
/tmp/ks-script-jn_rgq_r: line 19: syntax error near unexpected tokennewline' /tmp/ks-script-jn_rgq_r: line 19:
<%= snippet ‘fix_hosts’ %>’journal.log
Dec 29 12:17:45 desk-01.demo.com anaconda[1946]: program: Running in chroot ‘/mnt/sysimage’… /bin/sh /tmp/ks-script-jn_rgq_r
Dec 29 12:17:45 desk-01.demo.com anaconda[1946]: program: Too few arguments.
Dec 29 12:17:45 desk-01.demo.com anaconda[1946]: program: /tmp/ks-script-jn_rgq_r: line 19: syntax error near unexpected tokennewline' Dec 29 12:17:45 desk-01.demo.com anaconda[1946]: program: /tmp/ks-script-jn_rgq_r: line 19:
<%= snippet ‘fix_hosts’ %>’
Dec 29 12:17:45 desk-01.demo.com anaconda[1946]: program: Return code: 2
Dec 29 12:17:45 desk-01.demo.com anaconda[1946]: anaconda: kickstart.script: Error code 2 running the kickstart script at line 79
My kickstart file is as follow:
#version=RHEL8
System language
lang en_US.UTF-8
keyboard usSystem timezone
timezone Asia/Jerusalem --isUtc
Reboot the node post installation
reboot
Install mode
text
Network information
network --bootproto=dhcp --activate
Installation media
#url --url=http://repo-server.rafrefet.local/centos/8/2/BaseOS
url --url=http://192.168.33.181/repos8.2/BaseOSCreate additional repo
#repo --name=“AppStream” --baseurl=http://repo-server.rafrefet.local/centos/8/2/AppStream --install
repo --name=“AppStream” --baseurl=http://192.168.33.181/repos8.2/AppStream --install
repo --name=“Base” --baseurl=http://192.168.33.181/repos8.2/BaseOS --install
repo --name=“epel” --baseurl=http://192.168.33.181/repos8.1/epel --install
repo --name=“Extras” --baseurl=http://192.168.33.181/repos8.2/extras --installbootloader --location=mbr --append=“rhgb quiet crashkernel=auto”
Root password
- how to create the root password?
rootpw --plaintext systemxx2
System services
services --enabled=“chronyd”
zerombr
Partition clearing information
clearpart --all --initlabel
ignoredisk --only-use=sda
autopart --type=lvmAuthentication option
authselect --passalgo=sha512 --useshadow
selinux --disabled
firewall --enabled --ssh
firstboot --disabledSetup Ansible user
#user --name=ansible --shell=/bin/bash --homedir=/home/ansible --iscrypted --password=$6$uDYy2g62$vL4QDPhwVqFXGvpwoRG9beqxX.QntTTaIakbYEyj1I8OAF6Ctg6VdGTH3HAg.8os4DErB03EmlynGMJrASoYx/
EULA
eula --agreed
X Window System configuration information
xconfig --startxonboot
List of packages to be installed
%packages
bash-completion
@Server with GUI
#@GNOME Applications
#@Development Tools
#@Legacy UNIX Compatibility
#@KDE Plasma Workspaces
#@Platform Development
@Network File System Client
@Security Tools
@System Tools
%endAdd on
%addon com_redhat_kdump --disable
%end%post
Disable gpgcheck in all repositories
#sed -i 's/^gpgcheck.//g’ /etc/yum.repos.d/ && sed -i ‘s/enabled=1/enabled=1 \ngpgcheck=0\n/g’ /etc/yum.repos.d/*
mkdir /etc/yum.repos.d/centos-orig-repos
mv /etc/yum.repos.d/CentOSrepo /etc/yum.repos.d/centos-orig-repos
for i in /etc/yum.repos.d/.repo;do echo “gpgcheck=0” >> $i; done<%= snippet ‘fix_hosts’ %>
echo “after snippet” >> /root/host-name
%end