I am writing a hp ilo module to automatically assign a static ip that is
derived from the IP of the system which is fed in via facter. I basically just
need to change the network the ilo is connected to.
The ruby code works great inside the irb console. However, puppet doesn't seem
to be able to use the variable I have derived from the ipaddress. This is my
first template so I am not exactly sure if I can use ruby syntax inside a
template.
Any ideas on how I can accomplish this?
# Define the two variables which will be used to determin which network the ilo
will go on
ilonet = '21'
gwbit = '240'
dns = '10.0.1.19'
netmask = '255.255.255.0'
iparray = ipaddress.split('.')
iloip = iparray[0] + '.' + iparray[1] + '.' + iparray[2] + '.' + ilonet
gwarray = iloip.split('.')
gateway = gwarray[0] + '.' + gwarray[1] + '.' + gwarray[2] + '.' + gwbit
<RIBCL VERSION="2.0">
<LOGIN USER_LOGIN="adminname" PASSWORD="password">
<SERVER_INFO MODE="write">
<SERVER_NAME value ="<%= hostname %>"/>
</SERVER_INFO>
<RIB_INFO MODE="write">
<MOD_NETWORK_SETTINGS>
<SPEED_AUTOSELECT VALUE = "Y"/>
<IP_ADDRESS VALUE = "<%= iloip %>"/>
<SUBNET_MASK VALUE = "<%= netmask %>"/>
<GATEWAY_IP_ADDRESS VALUE = "<%= gateway %>"/>
<DNS_NAME VALUE = "ilo-<%= hostname %>"/>
<PRIM_DNS_SERVER value = "<%= dns %>"/>
<DHCP_ENABLE VALUE = "N"/>
<DOMAIN_NAME VALUE = ""/>
</MOD_NETWORK_SETTINGS>
</RIB_INFO>
<USER_INFO MODE="write">
<ADD_USER
USER_NAME="User"
USER_LOGIN="admin"
PASSWORD="changeme">
<ADMIN_PRIV value ="Y"/>
<REMOTE_CONS_PRIV value ="Y"/>
<RESET_SERVER_PRIV value ="Y"/>
<VIRTUAL_MEDIA_PRIV value ="Y"/>
<CONFIG_ILO_PRIV value="Yes"/>
</ADD_USER>
</USER_INFO>
</LOGIN>
</RIBCL>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.