Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v1
file 67 lines (52 sloc) 1.716 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
bash -c '
(
echo "export PS1=\"\\\\H:\\\\w\\\\\\$ \"" >> /etc/profile
)

echo <%= @config[:chef_node_name] %> > /tmp/chef_node_name

PROPERHOSTNAME=`cat /tmp/chef_node_name | cut -d. -f1`
PROPERDNSDOMAINNAME=`cat /tmp/chef_node_name | sed s/^$PROPERHOSTNAME.//`

IPV4ADDR=`ip addr | grep eth0 | grep "inet " | cut -d " " -f 6 | cut -d \/ -f 1`

NETCONF="/etc/sysconfig/network"
grep "^HOSTNAME=${PROPERHOSTNAME}$" ${NETCONF} || ( sed -i s/^HOSTNAME.*$// ${NETCONF} && echo "HOSTNAME=${PROPERHOSTNAME}" >> ${NETCONF})

(
cat <<EOF
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
${IPV4ADDR} ${PROPERHOSTNAME}.${PROPERDNSDOMAINNAME} ${PROPERHOSTNAME}
EOF
) > /etc/hosts

hostname $PROPERHOSTNAME


/sbin/service iptables stop
/sbin/chkconfig iptables off
rpm -Uvh http://yum.afistfulofservers.net/affs/fedora/13/noarch/affs-release-13-1.noarch.rpm

yum clean all
yum -y install libselinux-ruby
yum -y install affs-chef
yum -y install affs-ohai


(
cat <<'EOP'
<%= IO.read(Chef::Config[:validation_key]) %>
EOP
) > /tmp/validation.pem
awk NF /tmp/validation.pem > /etc/chef/validation.pem
rm /tmp/validation.pem

(
cat <<'EOP'
log_level :info
log_location STDOUT
chef_server_url "<%= Chef::Config[:chef_server_url] %>"
validation_client_name "<%= Chef::Config[:validation_client_name] %>"
<% if @config[:chef_node_name] == nil %>
# Using default node name"
<% else %>
node_name "<%= @config[:chef_node_name] %>"
<% end %>
EOP
) > /etc/chef/client.rb

(
cat <<'EOP'
<%= { "run_list" => @run_list }.to_json %>
EOP
) > /etc/chef/first-boot.json

/usr/bin/chef-client -j /etc/chef/first-boot.json
'
Something went wrong with that request. Please try again.