Ask Your Question

referencing variables inside exec command

asked 2015-05-20 19:15:03 -0600

johntest gravatar image

updated 2015-05-20 19:27:31 -0600

GregLarkin gravatar image

I have tried a few different methods but not able to successfully reference variables inside exec command in same class. How can I do this correctly please? Thanks.

class zabbixha_post (
  $zabclusterip     = '',
  $zabclustermask     = '24',
  ) {

   exec { 'create-ip':
     command => '/usr/sbin/pcs resource create ClusterIP ocf:heartbeat:IPaddr2 ip=<%=scope.lookupvar('zabbixha_post::zabclusterip') %>  cidr_netmask=<%=scope.lookupvar('zabbixha_post::zabclustermask') %> op monitor interval=5s',

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-05-20 19:28:30 -0600

GregLarkin gravatar image

Simply refer to them with their name, e.g. ${zabclusterip}, but also make sure to change the single quotes around your command to double quotes so variable interpolation works.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-05-20 19:15:03 -0600

Seen: 4,497 times

Last updated: May 20 '15