I’ve looked at the documentation for puppet variables and can’t seem to get my head around how to apply this to the following situation:
if vagrant (local machine)
phpfpm::nginx::vhost { 'vhost_name':
server_name => 'dev.demo.com',
root => '/vagrant/public',
}
else if aws ec2 (remote machine)
phpfpm::nginx::vhost { 'vhost_name':
server_name => 'demo.com',
root => '/home/ubuntu/demo.com/public',
}
Thanks
Try running facter on both your vagrant host and your EC2 instance, and look for differences. I suspect that ‘facter virtual’ may be different between the two hosts, or that the EC2 may return a bunch of ec2_ facts that won’t be present on the vagrant host.
Then you can use this fact as a top level variable as per below. I switched to a case statement as well, since that’s a little easier to maintain IMHO, plus you can use the default block for error checking.