How can I make the last exec resource parse variables?
Currently it is coming out blank inside rc.local file as such:
[root@server1 ~]# cat /etc/rc.local
#!/bin/sh
/usr/sbin/balance -b 127.0.0.1 3306 :3306 ! :3306
Also for clarification, the "run-balance" exec resource produces the correct output with properly parsed variables and these are the same variables used in the following "add-rclocal" resource.
Class
class balance (
$dbserver1 = 'server1',
$dbserver2 = 'server2',
) {
package { 'balance': ensure => "installed",
}->
exec { 'run-balance':
command => "/usr/sbin/balance -b 127.0.0.1 3306 ${dbserver1}:3306 ! ${dbserver2}:3306",
unless => '/bin/ps afx | grep balance > /dev/null',
}->
exec { 'add-rclocal':
command => "echo '/usr/sbin/balance -b 127.0.0.1 3306 ${dbserver1}:3306 ! ${dbserver2}:3306' >> /etc/rc.local",
}
}