Ask Your Question

What's the difference between Parameter and Variable in Puppet?

asked 2017-07-03 22:26:24 -0600

Sam online gravatar image

Hello All,

Can someone please help me understand what's the difference between Parameter and Variable in Puppet?

From Puppet Docs: Variables store values so they can be accessed later. Also they are constants, meaning we can't define same variable with another variable in the same the same scope. I get that. Ex: $content = "some content\n"

I get that above part. Then, what is the parameter? Isn't the same thing. This part is little confusing. If someone can please help me with an example, that would be very helpful. Thank you very much.


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-07-05 14:53:01 -0600

DevOpsProDude gravatar image

A parameter is a variable defined at the top of a class within () that can be overridden with hiera or within a class call and used by any other class.

A variable is defined within the class, cannot be overridden by hiera (unless the variable is using a hiera lookup), but can be used by any other class.

The big difference there is whether the variable can be overridden or not.

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: 2017-07-03 22:26:24 -0600

Seen: 181 times

Last updated: Jul 05 '17