Foreman + katello, segregate contents on regional basis

Hello guys,

Needs some thoughts on how I can acheive below stuffs in foreman+katello

For example I have ntp puppet module and I want to define ntp servers as
regional basis, I have 3 regions ,AP, EU, US

How do I make AP gets serverA and serverB, EU gets serverB and SERVERC ??

So when I start provisioning I should be able to define it

Also how can I assign default puppet moduels to all host while provisioning
rather then manually clicking those ?

Is there any way where I can write custom ruby script to findout regions
and then use it to segrigate contents while provisioning…

Appriciate some thoughts…

Thanks,
Dj

Thanks Dominic,

where do i find the location feature ?, can you share some document …

Sorry i am bit new and just started exploring it … by smart class you
mean … go to Puppet Classes, click on class and there, i found option for
smart class parameter ? so i have to define that in ntp manifest ? ( i
did not understand that +Add Matcher value, if that's where i need to
assign it ? )

Regards,
DJ

··· On Thursday, 20 March 2014 15:11:58 UTC+5:30, Dominic Cleal wrote: > > On 20/03/14 09:20, Unix SA wrote: > > Hello guys, > > > > Needs some thoughts on how I can acheive below stuffs in foreman+katello > > > > For example I have ntp puppet module and I want to define ntp servers as > > regional basis, I have 3 regions ,AP, EU, US > > > > How do I make AP gets serverA and serverB, EU gets serverB and SERVERC > ?? > > > > So when I start provisioning I should be able to define it > > If you're using Foreman's locations feature, then you could set a smart > class parameter matcher on your "ntp" Puppet class's server parameter > based on the location. > > In Foreman 1.4, you can also set global parameters on the location > itself, but if you're configuring NTP via Puppet then global parameters > are discouraged. (Smart) class parameters should be better. > > If you're not using locations, you could use subnets, domains, host > groups or even a custom fact (say, based on hostname) inside your smart > class parameter matchers. > > > Also how can I assign default puppet moduels to all host while > > provisioning rather then manually clicking those ? > > Use host groups. > > > Is there any way where I can write custom ruby script to findout regions > > and then use it to segrigate contents while provisioning... > > I'm not sure I understand exactly what you mean. > > -- > Dominic Cleal > Red Hat Engineering >

Hi,

please ignore my previous comment, i found how to create new location.

now i have assigned host1 to AP and host2 to EU… in puppet classes ->
smart parameters i have created matcher and defined

location=EU values=["1", "2", "3"] and added one more matcher location=AP
values=["4","5","6"] … Still after puppet run i dont see change on NTP
servers :frowning:

one more issue is, after assigning location to particular host …if i
change host to different location it gives me error " Cannot Update
Location to "AP" because of mismatch in settings" … what it's referring
to ? how do i debug it ?

Regards,
DJ

··· On Thursday, 20 March 2014 15:11:58 UTC+5:30, Dominic Cleal wrote: > > On 20/03/14 09:20, Unix SA wrote: > > Hello guys, > > > > Needs some thoughts on how I can acheive below stuffs in foreman+katello > > > > For example I have ntp puppet module and I want to define ntp servers as > > regional basis, I have 3 regions ,AP, EU, US > > > > How do I make AP gets serverA and serverB, EU gets serverB and SERVERC > ?? > > > > So when I start provisioning I should be able to define it > > If you're using Foreman's locations feature, then you could set a smart > class parameter matcher on your "ntp" Puppet class's server parameter > based on the location. > > In Foreman 1.4, you can also set global parameters on the location > itself, but if you're configuring NTP via Puppet then global parameters > are discouraged. (Smart) class parameters should be better. > > If you're not using locations, you could use subnets, domains, host > groups or even a custom fact (say, based on hostname) inside your smart > class parameter matchers. > > > Also how can I assign default puppet moduels to all host while > > provisioning rather then manually clicking those ? > > Use host groups. > > > Is there any way where I can write custom ruby script to findout regions > > and then use it to segrigate contents while provisioning... > > I'm not sure I understand exactly what you mean. > > -- > Dominic Cleal > Red Hat Engineering >

> Hello guys,
>
> Needs some thoughts on how I can acheive below stuffs in foreman+katello
>
> For example I have ntp puppet module and I want to define ntp servers as
> regional basis, I have 3 regions ,AP, EU, US
>
> How do I make AP gets serverA and serverB, EU gets serverB and SERVERC ??
>
> So when I start provisioning I should be able to define it

If you're using Foreman's locations feature, then you could set a smart
class parameter matcher on your "ntp" Puppet class's server parameter
based on the location.

In Foreman 1.4, you can also set global parameters on the location
itself, but if you're configuring NTP via Puppet then global parameters
are discouraged. (Smart) class parameters should be better.

If you're not using locations, you could use subnets, domains, host
groups or even a custom fact (say, based on hostname) inside your smart
class parameter matchers.

> Also how can I assign default puppet moduels to all host while
> provisioning rather then manually clicking those ?

Use host groups.

> Is there any way where I can write custom ruby script to findout regions
> and then use it to segrigate contents while provisioning…

I'm not sure I understand exactly what you mean.

··· On 20/03/14 09:20, Unix SA wrote:


Dominic Cleal
Red Hat Engineering

Hey,

> where do i find the location feature ?, can you share some document …

http://projects.theforeman.org/projects/1/wiki/LocationsAndOrganizations

GIYF

> Sorry i am bit new and just started exploring it … by smart class you
> mean … go to Puppet Classes, click on class and there, i found option for
> smart class parameter ? so i have to define that in ntp manifest ? ( i
> did not understand that +Add Matcher value, if that's where i need to
> assign it ? )

Have you read our 1.4 manual?

http://theforeman.org/manuals/1.4/

··· -- Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman