0

I am trying to call the same method "host_present" twice. But I am facing the following error

Parameter 'ensure' is already set on host_present[test] by # at /opt/puppetlabs/puppet/modules/manifests/host_1.pp:12; cannot redefine at /opt/puppetlabs/puppet/modules/manifests/host_1.pp:13 on node devopenstack

define host_present()
{
        host { 'puppet_host':
        persona    => 'TEST',
        url        => 'https://user:password',
        }
}

host_present{"test": ensure => present}
host_present["test"]{ ensure => absent}

Can someone help.

Sathish
  • 227
  • 3
  • 11

1 Answers1

0

Those are not methods, they are resources. Puppet is a declarative language. When you declare on one line ensure => present and then on the next ensure => absent, Puppet understands this as two inconsistent declarations about the end-state, and so it throws an error.

You will need to spend some time learning Puppet from tutorials, etc.

Alex Harvey
  • 14,494
  • 5
  • 61
  • 97