In a puppet class how should I test if a variable has been set in a node. I use a VM name (like server1) and a domain name (like example.org) where User can reach the page. example.org won't be saved as a fact. For example.org I need to define a variable. After some test I find this way to define the variable in node and use it in my test class for my settings.
node "VM1" { class { 'test': domainname => "example.org", }
class test ($domainname) { ini_setting { 'set_property': ensure => present, path => '/tmp/test.ini', section => 'main', setting => 'url', value => "https://$domainname"; }
But now I want to add a condition, if domainname isn't set use the hostname from facter.
ini_setting { 'set_property': ensure => present, path => '/tmp/test.ini', section => 'main', setting => 'url', if $domainname !~ $hostname { value => "https://$domainname"; } else { value => "https://$hostname"; }
But now I get everytime an error like this.
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Syntax error at 'domainname'
Aucun commentaire:
Enregistrer un commentaire