You need to go to a specific puppet class and add it there. -Brian
···
On Wed, Jul 25, 2012 at 11:39 AM, Jason Knudsen wrote:
Hey guys,
First off – awesome job putting out the 1.0 GA release! Really loving the
improvements!
I haven’t really used Smart Variables at all yet, but I’d like to (if I
indeed understand how they work… more on that later). Right now, it seems
like something might be broken in my installation though.
So right now, logged in as Admin, when I go to more - smart variables I
don’t have anything listed. I believe I used to have a button to create a
new smart variable but that seems to be gone now and I’m unaware of how to
create a new variable?
https://lh6.googleusercontent.com/-ah2SpfQIu2M/UBASPHHBu_I/AAAAAAAAAuM/gRkzRXc5_j0/s1600/Screen+Shot+2012-07-25+at+11.35.04+AM.png
I’ve checked logs and whatnot, nothing is coming up though. I didn’t
install via RPM, I’ve actually pulled from GIT and otherwise everything
else seems to be working great:
git clone https://github.com/theforeman/foreman.git -b 1.0-stable
–
You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/foreman-users/-/Rcvt9WwcppUJ.
To post to this group, send email to foreman-users@googlegroups.com.
To unsubscribe from this group, send email to
foreman-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/foreman-users?hl=en.
–
http://aws.amazon.com/solutions/solution-providers/brandorr/
Hey Brian,
Thanks for the tip – I got it figured out now. That makes a lot of sense

So I have an iptables manifest that can be called to define what role (or
roles) a system has. I used to call it from nodes.pp, by defining it as
such:
iptables::role { "web-server": }
And it would inherit the correct iptables rules for "web-server"
define role() {
include iptables
file { "/root/iptables/roles/${name}":
source => "puppet:///modules/iptables/${name}.role",
replace => false,
require => File["/root/iptables/roles"],
notify => Exec["run-iptables"],
}
What's the best approach of having the same functionality from within
Foreman? Should I use parameters on the host or smart variables? I haven't
been able to get it to work with either approach yet, but I can see it's
defined when I run the node.rb against the host.
Thanks,
Jason
···
On Wednesday, July 25, 2012 12:10:29 PM UTC-4, Brian Gupta wrote:
>
> You need to go to a specific puppet class and add it there. -Brian
>
> On Wed, Jul 25, 2012 at 11:39 AM, Jason Knudsen wrote:
>
>> Hey guys,
>>
>> First off -- awesome job putting out the 1.0 GA release! Really loving
>> the improvements!
>>
>> I haven't really used Smart Variables at all yet, but I'd like to (if I
>> indeed understand how they work.. more on that later). Right now, it seems
>> like something might be broken in my installation though.
>>
>> So right now, logged in as Admin, when I go to more - smart variables I
>> don't have anything listed. I believe I used to have a button to create a
>> new smart variable but that seems to be gone now and I'm unaware of how to
>> create a new variable?
>>
>>
>>
>>
>> I've checked logs and whatnot, nothing is coming up though. I didn't
>> install via RPM, I've actually pulled from GIT and otherwise everything
>> else seems to be working great:
>>
>> git clone https://github.com/theforeman/foreman.git -b 1.0-stable
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Foreman users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/foreman-users/-/Rcvt9WwcppUJ.
>> To post to this group, send email to foreman-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> foreman-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/foreman-users?hl=en.
>>
>
>
>
> --
>
>
>
I've played with parameters, but not smartvars, so don't feel I am equipped
to answer your question. I am fairly certain either will work.
A little about parameters. Basically if you look at the ENC output, it
shows up as a globally scoped puppet variable, that has
a hierarchical scoping within foreman. (Please let me know if you don't
understand what I mean here.)
In foreman you are going to need apply an appropriate class or classes, to
a host or hostgroup, and make sure the relevant class(es) that are applied
or included use that variable. You can use it just like any other puppet
variable at the global scope. (Like facts.)
Not too familiar with the "define" puppet syntax, so will defer to others
regarding getting your code working.
One additional note you can set parameters at host, hostgroup, os and
domain, and change their order of precedence in the server settings. (This
is global.)
Thanks,
Brian
···
On Wed, Jul 25, 2012 at 1:48 PM, Jason Knudsen wrote:
Hey Brian,
Thanks for the tip – I got it figured out now. That makes a lot of sense

So I have an iptables manifest that can be called to define what role (or
roles) a system has. I used to call it from nodes.pp, by defining it as
such:
iptables::role { “web-server”: }
And it would inherit the correct iptables rules for “web-server”
define role() {
include iptables
file { "/root/iptables/roles/${name}":
source => "puppet:///modules/iptables/${name}.role",
replace => false,
require => File["/root/iptables/roles"],
notify => Exec["run-iptables"],
}
What’s the best approach of having the same functionality from within
Foreman? Should I use parameters on the host or smart variables? I haven’t
been able to get it to work with either approach yet, but I can see it’s
defined when I run the node.rb against the host.
Thanks,
Jason
On Wednesday, July 25, 2012 12:10:29 PM UTC-4, Brian Gupta wrote:
You need to go to a specific puppet class and add it there. -Brian
On Wed, Jul 25, 2012 at 11:39 AM, Jason Knudsen jason.knudsen@gmail.comwrote:
Hey guys,
First off – awesome job putting out the 1.0 GA release! Really loving
the improvements!
I haven’t really used Smart Variables at all yet, but I’d like to (if I
indeed understand how they work… more on that later). Right now, it seems
like something might be broken in my installation though.
So right now, logged in as Admin, when I go to more - smart variables I
don’t have anything listed. I believe I used to have a button to create a
new smart variable but that seems to be gone now and I’m unaware of how to
create a new variable?
https://lh6.googleusercontent.com/-ah2SpfQIu2M/UBASPHHBu_I/AAAAAAAAAuM/gRkzRXc5_j0/s1600/Screen+Shot+2012-07-25+at+11.35.04+AM.png
I’ve checked logs and whatnot, nothing is coming up though. I didn’t
install via RPM, I’ve actually pulled from GIT and otherwise everything
else seems to be working great:
git clone https://github.com/theforeman/**foreman.git https://github.com/theforeman/foreman.git -b 1.0-stable
–
You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To view this discussion on the web visit https://groups.google.com/d/**
msg/foreman-users/-/Rcvt9WwcppUJhttps://groups.google.com/d/msg/foreman-users/-/Rcvt9WwcppUJ
.
To post to this group, send email to foreman-users@googlegroups.com.
To unsubscribe from this group, send email to foreman-users+unsubscribe@
googlegroups.com foreman-users%2Bunsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/
group/foreman-users?hl=enhttp://groups.google.com/group/foreman-users?hl=en
.
–
http://aws.amazon.com/solutions/solution-providers/brandorr/
–
You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/foreman-users/-/pTiNZnKzxPgJ.
To post to this group, send email to foreman-users@googlegroups.com.
To unsubscribe from this group, send email to
foreman-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/foreman-users?hl=en.
–
http://aws.amazon.com/solutions/solution-providers/brandorr/
That sounds like you're using a Define there, right? I would suggest a
couple of options.
- Use a list of roles as a host(group) parameter. So in Foreman I
might set
roles=web,db
and then in puppet, i would create a wrapper class:
class iptables::role_wrapper
Defines can loop over an array…
$roles_array=split($::roles,',')
iptables::role { $roles_array: }
}
Obviously roles can then become a smart variable. You can take this
approach further and use things like Hiera, etc.
Or (2) Write a wrapper class specific to a role. So maybe:
class webserver {
include a class
include nginx::webserver
call a define
iptables::role { "webserver": }
}
Hope that helps,
Greg
···
On 25/07/12 18:48, Jason Knudsen wrote:
> Hey Brian,
>
> Thanks for the tip -- I got it figured out now. That makes a lot of
> sense ;-)
>
> So I have an iptables manifest that can be called to define what
> role (or roles) a system has. I used to call it from nodes.pp, by
> defining it as such:
>
> iptables::role { "web-server": }
>
> And it would inherit the correct iptables rules for "web-server"
>
> define role() {
>
> include iptables
>
> file { "/root/iptables/roles/${name}":
>
> source => "puppet:///modules/iptables/${name}.role",
>
> replace => false,
>
> require => File["/root/iptables/roles"],
>
> notify => Exec["run-iptables"],
>
> }
>
> What's the best approach of having the same functionality from
> within Foreman? Should I use parameters on the host or smart
> variables? I haven't been able to get it to work with either
> approach yet, but I can see it's defined when I run the node.rb
> against the host.