compass-adapters/cobbler/snippets/suse_post_anamon
Xicheng Chang 587250bfae Add Ansible playbooks and modified cobbler snippets
Change-Id: If759d0fa469d3d40ab92e3359c6f9dfdbebe7214
2015-04-04 13:17:23 -07:00

57 lines
1.9 KiB
Plaintext

#if $str($getVar('anamon_enabled','')) == "1"
#if $getVar("compass_server", "") != ""
wget -O /usr/local/sbin/anamon "http://$compass_server:$http_port/cobbler/aux/anamon"
#else
wget -O /usr/local/sbin/anamon "http://$server:$http_port/cobbler/aux/anamon"
#end if
cat << EOF > /etc/init.d/anamon.init
#raw
#!/bin/bash
## BEGIN INIT INFO
# Required-Start: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 6
# Short-Description: Starts the cobbler anamon boot notification program
# Description: anamon runs the first time a machine is booted after installation.
## END INIT INFO
#end raw
#if $getVar("compass_server","") != ""
/usr/local/sbin/anamon --watchfile "/var/log/YaST2/y2start.log /var/log/YaST2/y2log" --name $name --server $compass_server --port $http_port --exit
#else
/usr/local/sbin/anamon --watchfile "/var/log/YaST2/y2start.log /var/log/YaST2/y2log" --name $name --server $server --port $http_port --exit
#end if
chkconfig -d anamon.init
mv /etc/init.d/anamon.init /tmp/anamon.init
EOF
chmod 755 /etc/init.d/anamon.init /usr/local/sbin/anamon
chkconfig anamon.init on
#end if
## place start-up script for updating os state
#if $getVar('compass_server', '') != ""
#set srv = $getVar('compass_server','')
#else
#set srv = $getVar('server','')
#end if
cat << EOF > /etc/init.d/set_state
#raw
#!/bin/bash
## BEGIN INIT INFO
# Required-Start: $network $sshd
# Default-Start: 3 5
# Default-Stop: 0 1 2 4 6
# Short-Description: Notifies the os installation is finished
# Description: set_state runs the first time a machine is booted after
# installation.
## END INIT INFO
#end raw
wget -O /tmp/os_state --post-data='{"ready": true}' --header=Content-Type:application/json "http://$srv/api/hosts/${hostname}/state_internal"
chkconfig -d set_state
mv /etc/init.d/set_state /tmp/set_state
EOF
chmod 755 /etc/init.d/set_state
chkconfig set_state on