diff --git a/app/views/unattended/provisioning_templates/provision/kickstart_default.erb b/app/views/unattended/provisioning_templates/provision/kickstart_default.erb index c1848ae24cfd..ef9133c847a9 100644 --- a/app/views/unattended/provisioning_templates/provision/kickstart_default.erb +++ b/app/views/unattended/provisioning_templates/provision/kickstart_default.erb @@ -360,6 +360,8 @@ sed -e 's/DEFAULTKERNEL=kernel-uek/DEFAULTKERNEL=kernel/g' -i /etc/sysconfig/ker <%= snippet 'insights' if host_param_true?('host_registration_insights') && os_major < 9 -%> +<%= snippet 'first_boot_setup' %> + touch /tmp/foreman_built chvt 1 @@ -384,7 +386,6 @@ The last post section halts Anaconda to prevent endless loop in case HTTP reques if test -f /tmp/foreman_built; then echo "calling home: build is done!" - <%= indent(2, skip1: true) { snippet('built', :variables => { :endpoint => 'built', :method => 'POST', :body_file => '/root/install.post.log' }) } -%> else echo "calling home: build failed!" <%= indent(2, skip1: true) { snippet('built', :variables => { :endpoint => 'failed', :method => 'POST', :body_file => '/root/install.post.log' }) } -%> diff --git a/app/views/unattended/provisioning_templates/snippet/first_boot_setup.erb b/app/views/unattended/provisioning_templates/snippet/first_boot_setup.erb new file mode 100644 index 000000000000..8a92ab4ed5ac --- /dev/null +++ b/app/views/unattended/provisioning_templates/snippet/first_boot_setup.erb @@ -0,0 +1,14 @@ +<%# +kind: snippet +name: first_boot_setup +model: ProvisioningTemplate +snippet: true +description: | + Post replacement. +-%> +<%= save_to_file('/etc/systemd/system/first_boot_setup_service.service', + snippet('first_boot_setup_service')) %> +<%= save_to_file('/root/fist_boot_setup_script.sh', + snippet('first_boot_setup_script')) %> +systemctl enable initial_setup +chmod +x '/root/initial_setup.sh' \ No newline at end of file diff --git a/app/views/unattended/provisioning_templates/snippet/first_boot_setup_service.erb b/app/views/unattended/provisioning_templates/snippet/first_boot_setup_service.erb new file mode 100644 index 000000000000..085298174c53 --- /dev/null +++ b/app/views/unattended/provisioning_templates/snippet/first_boot_setup_service.erb @@ -0,0 +1,20 @@ +<%# +kind: snippet +name: first_boot_setup_service +model: ProvisioningTemplate +snippet: true +description: | + Post replacement service +-%> +[Unit] +Description=Initial setup callback +Wants=network-online.target +After=network-online.target + +[Service] +ExecStart=/bin/bash /root/fist_boot_setup_script.sh +RemainAfterExit=true +Type=oneshot + +[Install] +WantedBy=multi-user.target diff --git a/app/views/unattended/provisioning_templates/snippet/fist_boot_setup_script.erb b/app/views/unattended/provisioning_templates/snippet/fist_boot_setup_script.erb new file mode 100644 index 000000000000..2b5a045afe5e --- /dev/null +++ b/app/views/unattended/provisioning_templates/snippet/fist_boot_setup_script.erb @@ -0,0 +1,9 @@ +<%# +kind: snippet +name: first_boot_setup_script +model: ProvisioningTemplate +snippet: true +description: | + First boot setup script +-%> +<%= indent(2, skip1: true) { snippet('built', :variables => { :endpoint => 'built', :method => 'POST', :body_file => '/root/install.post.log' }) } -%> \ No newline at end of file