Re: [Puppet Users] how to do conditional check?
Thanks kc! I probably didn't myself clear. I don't wanna create the the config directory, in stead,* if it exists*, then make sure config file is present with those info. Cheers!! -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/FN4cuCrWX94J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] how to do conditional check?
Dear all, This is my script in the bash: how can I put it into puppet? #!/usr/bin/env bash CONF_DIR=/var/mom_priv CPU_COUNT=`cat /proc/cpuinfo | grep siblings | uniq | cut -d\ -f2` ideal_load_var=$(echo scale=2; ${CPU_COUNT}+0.5 | bc) max_load_var=$(echo scale=2; ${CPU_COUNT}*1.2 | bc) if [ -d ${CONF_DIR} ]; then cat EOF ${CONF_DIR}/config \$ideal_load ${ideal_load_var} \$max_load ${max_load_var} EOF fi All I wann do is: Get the CPU_COUNT and then if CONF_DIR exists, make sure $CONF_DIR/config is present with the above lines. How should I write that for puppet? Cheers!! -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Uyz5hQSJX9AJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] how to do conditional check?
On Jun 10, 2011, at 4:10 PM, Sans wrote: Dear all, This is my script in the bash: how can I put it into puppet? #!/usr/bin/env bash CONF_DIR=/var/mom_priv CPU_COUNT=`cat /proc/cpuinfo | grep siblings | uniq | cut -d\ -f2` ideal_load_var=$(echo scale=2; ${CPU_COUNT}+0.5 | bc) max_load_var=$(echo scale=2; ${CPU_COUNT}*1.2 | bc) if [ -d ${CONF_DIR} ]; then cat EOF ${CONF_DIR}/config \$ideal_load ${ideal_load_var} \$max_load ${max_load_var} EOF fi All I wann do is: Get the CPU_COUNT and then if CONF_DIR exists, make sure $CONF_DIR/config is present with the above lines. How should I write that for puppet? Cheers!! I don't have a lot of time, but I can get you started. Puppet way: 1) Create a File resource that creates the config directory. 2) Run facter at the command line and look for the name of the variable that tells how many processors the computer has. That variable will exist when the catalog is compiled as a variable. 3) Use a template with File to create your config file. Quicker way: (Not reccomended) 1) Copy that script to the computer using File. 2) Run the script using Exec. -- You received this message because you are subscribed to the Google Groups Puppet Users group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.