Forman with r10k

Has anyone used Forman with r10k?

what does r10k do?

··· On Thu, Jul 31, 2014 at 4:08 PM, Dan Cruver wrote:

Has anyone used Forman with r10k?


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Peter L. Berghold Salty.Cowdawg@gmail.com

http://blog.berghold.net

Hi

I am very happy with r10k*. It needs some hook magic to make it work with
my GitLab and Puppet Master. Now i manage 15+ environments with it (mainly
for our dev and qa). If you have just 2 environments it might be an
overkill.

··· 2014-07-31 22:08 GMT+02:00 Dan Cruver :

Has anyone used Forman with r10k?


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

I use r10k and Foreman but I no longer manage Puppet class assignment in Foreman. I use the ENC for top-scope variables and setting a hosts environment. All my puppet class parameters and assignment is done in Hiera.

Using the r10k Mcollective agent works like a dream when dealing with multiple puopetmasters. The r10k puppet module provides the agent.

  • Trey

How do you configure it?

I tried setting up plain directory environments
(http://docs.puppetlabs.com/puppet/latest/reference/environments.html) by
adding environmentpath = $confdir/environments to my puppet.conf but forman
would not pick up on my environment directories I created unless I created
ini entries for them like so:

[production]
modulepath = $confdir/environments/production/modules
manifest = $confdir/environments/production/manifests

[development]
modulepath = $confdir/environments/development/modules
manifest = $confdir/environments/development/manifests

Puppet will ignore these when the environmentpath is defined but for some
reason I need it for foreman to discover it.

puppet.conf (2.59 KB)

··· On Thursday, July 31, 2014 4:08:52 PM UTC-4, Dan Cruver wrote: > > Has anyone used Forman with r10k? >

Ensure you have foreman-proxy 1.5.2, as this adds support for directory
environments.

··· On 04/08/14 18:54, Dan Cruver wrote: > I tried setting up plain directory environments > (http://docs.puppetlabs.com/puppet/latest/reference/environments.html) > by adding environmentpath = $confdir/environments to my puppet.conf but > forman would not pick up on my environment directories I created unless > I created ini entries for them like so: > > [production] > modulepath = $confdir/environments/production/modules > manifest = $confdir/environments/production/manifests > > [development] > modulepath = $confdir/environments/development/modules > manifest = $confdir/environments/development/manifests > > Puppet will ignore these when the environmentpath is defined but for > some reason I need it for foreman to discover it.


Dominic Cleal
Red Hat Engineering

At the time of writing I believe I was using atleast foreman-proxy 1.5.2
but since have also update to foreman 1.6.0 with foreman-proxy 1.6.0 and
still do not have any luck.

Currently I am using Puppet 3.7.1. I am using the Puppet > 3.6.0
configuration documented on this
page: https://github.com/adrienthebo/r10k/blob/master/doc/dynamic-environments/master-configuration.mkd

When I run the "Import from <puppet-master>" command it says there are no
changes. Interestingly enough I have an example_env and test directory as
well in there but it does not see them.

When I go to create "New Puppet Environment" and name it something like
testenv. Then import again it will ask me to delete the environment.

When I go to create "New Puppet Environment" and name it something like
test (where a folder already exists). Then import again it will say no
changes.

If I move that folder to say test2 and do a reimport it will prompt me to
remove the test environment but will not ask me to add test2.

Thanks,
Dan

··· On Tuesday, August 5, 2014 3:35:02 AM UTC-4, Dominic Cleal wrote: > > On 04/08/14 18:54, Dan Cruver wrote: > > I tried setting up plain directory environments > > (http://docs.puppetlabs.com/puppet/latest/reference/environments.html) > > by adding environmentpath = $confdir/environments to my puppet.conf but > > forman would not pick up on my environment directories I created unless > > I created ini entries for them like so: > > > > [production] > > modulepath = $confdir/environments/production/modules > > manifest = $confdir/environments/production/manifests > > > > [development] > > modulepath = $confdir/environments/development/modules > > manifest = $confdir/environments/development/manifests > > > > Puppet will ignore these when the environmentpath is defined but for > > some reason I need it for foreman to discover it. > > Ensure you have foreman-proxy 1.5.2, as this adds support for directory > environments. > > -- > Dominic Cleal > Red Hat Engineering >

If you really want to start from scratch, you'll have to drop the database
and recreate it using Rails. Something like the following - note this will
wipe out your entire Foreman database, so as "scratch" as it gets.

foreman-rake db:drop

Then follow Foreman :: Manual

The host and reports are all in the database. Wiping that out will start
you from scratch.

As for using environments, I don't use directory environments as I'm still
on 1.5.1 and I don't pull my Puppet classes into Foreman. I use r10k to
deploy my modules and hiera. Hiera is used to provide class assignment and
parameter values. Foreman does everything else including provides the
host's environment.

[master]
autosign = $confdir/autosign.conf { mode = 664 }
reports = foreman
external_nodes = /etc/puppet/node.rb
node_terminus = exec
ca = true
ssldir = /var/lib/puppet/ssl
certname = puppetmaster01.DOMAIN
storeconfigs = true
storeconfigs_backend = puppetdb
strict_variables = false

manifest       = /etc/puppet/environments/$environment/manifests/site.pp
modulepath     = /etc/puppet/environments/$environment/modules
config_version =

That is done via the Puppet module provided by
https://forge.puppetlabs.com/theforeman/puppet.

··· On Tue, Sep 30, 2014 at 4:18 PM, Dan Cruver wrote:

I believe my Foreman may be in a bad state.

Under environments I have two but the counts are wrong.
I should have 1 development machine and 12 production machines.

development https://puppet.cmif.cubrc.org/environments/development/edit
-1
https://puppet.cmif.cubrc.org/hosts?search=environment+%3D+development
Classes
https://puppet.cmif.cubrc.org/puppetclasses?search=environment+%3D+development
https://puppet.cmif.cubrc.org/environments#
production https://puppet.cmif.cubrc.org/environments/production/edit14
https://puppet.cmif.cubrc.org/hosts?search=environment+%3D+productionIs
there a way I can clean up all reports and information about all machines
and start from scratch. I tried using foreman-installer again but guess
because it uses puppet it most likely detects certain files exist and
doesn’t modify them.
On Tuesday, August 5, 2014 3:35:02 AM UTC-4, Dominic Cleal wrote:

On 04/08/14 18:54, Dan Cruver wrote:

I tried setting up plain directory environments
(http://docs.puppetlabs.com/puppet/latest/reference/environments.html)
by adding environmentpath = $confdir/environments to my puppet.conf but
forman would not pick up on my environment directories I created unless
I created ini entries for them like so:

[production]
modulepath = $confdir/environments/production/modules
manifest = $confdir/environments/production/manifests

[development]
modulepath = $confdir/environments/development/modules
manifest = $confdir/environments/development/manifests

Puppet will ignore these when the environmentpath is defined but for
some reason I need it for foreman to discover it.

Ensure you have foreman-proxy 1.5.2, as this adds support for directory
environments.


Dominic Cleal
Red Hat Engineering


You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/foreman-users/O3SlFQquRTg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Thank you very much if I hit a dead end I will want to do this. I don't
have much history and just in the setup phase so some of the reports are
not even useful going forward. From your response to start from "Initial
Setup" i do not need to run foreman-installer again but is there harm doing
so. I would be just using my existing answer file to run it again. I have
done this in the past and as far as I can tell the foreman-installer is
idempotent assuming you don't change the answer file or other configuration
files after install.

Could I have a copy of your r10k and heira configurations? I would like to
set it up so their is a git repo for environments and a separate one for
heira.

··· On Tuesday, September 30, 2014 8:39:57 PM UTC-4, treydock wrote: > > If you really want to start from scratch, you'll have to drop the database > and recreate it using Rails. Something like the following - note this will > wipe out your entire Foreman database, so as "scratch" as it gets. > > foreman-rake db:drop > > Then follow http://theforeman.org/manuals/1.6/index.html#3.5.1InitialSetup > > The host and reports are all in the database. Wiping that out will start > you from scratch. > > As for using environments, I don't use directory environments as I'm still > on 1.5.1 and I don't pull my Puppet classes into Foreman. I use r10k to > deploy my modules and hiera. Hiera is used to provide class assignment and > parameter values. Foreman does everything else including provides the > host's environment. > > [master] > autosign = $confdir/autosign.conf { mode = 664 } > reports = foreman > external_nodes = /etc/puppet/node.rb > node_terminus = exec > ca = true > ssldir = /var/lib/puppet/ssl > certname = puppetmaster01.DOMAIN > storeconfigs = true > storeconfigs_backend = puppetdb > strict_variables = false > > manifest = > /etc/puppet/environments/$environment/manifests/site.pp > modulepath = /etc/puppet/environments/$environment/modules > config_version = > > > That is done via the Puppet module provided by > https://forge.puppetlabs.com/theforeman/puppet. > > > > On Tue, Sep 30, 2014 at 4:18 PM, Dan Cruver > wrote: > >> I believe my Foreman may be in a bad state. >> >> Under environments I have two but the counts are wrong. >> I should have 1 development machine and 12 production machines. >> >> development >> -1 >> >> Classes >> >> >> production 14 >> Is >> there a way I can clean up all reports and information about all machines >> and start from scratch. I tried using foreman-installer again but guess >> because it uses puppet it most likely detects certain files exist and >> doesn't modify them. >> On Tuesday, August 5, 2014 3:35:02 AM UTC-4, Dominic Cleal wrote: >> >>> On 04/08/14 18:54, Dan Cruver wrote: >>> > I tried setting up plain directory environments >>> > (http://docs.puppetlabs.com/puppet/latest/reference/environments.html) >>> >>> > by adding environmentpath = $confdir/environments to my puppet.conf >>> but >>> > forman would not pick up on my environment directories I created >>> unless >>> > I created ini entries for them like so: >>> > >>> > [production] >>> > modulepath = $confdir/environments/production/modules >>> > manifest = $confdir/environments/production/manifests >>> > >>> > [development] >>> > modulepath = $confdir/environments/development/modules >>> > manifest = $confdir/environments/development/manifests >>> > >>> > Puppet will ignore these when the environmentpath is defined but for >>> > some reason I need it for foreman to discover it. >>> >>> Ensure you have foreman-proxy 1.5.2, as this adds support for directory >>> environments. >>> >>> -- >>> Dominic Cleal >>> Red Hat Engineering >>> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Foreman users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/foreman-users/O3SlFQquRTg/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> foreman-user...@googlegroups.com . >> To post to this group, send email to forema...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/foreman-users. >> For more options, visit https://groups.google.com/d/optout. >> > >

It sounds like either the proxy isn't detecting the existence of those
environments at all, or they're empty.

Can you share your current puppet.conf config please? Also can you show
the on-disk layout (tree /etc/puppet) and confirm whether you have any
modules and Puppet classes inside those environments.

Regarding the counters you mentioned in the second reply, that's a known
issue and is harmless (Bug #5692: Puppet environment counters not updated - Foreman),
we're addressing it for 1.6.1.

Cheers,
Dominic

··· On 30/09/14 21:24, Dan Cruver wrote: > At the time of writing I believe I was using atleast foreman-proxy 1.5.2 > but since have also update to foreman 1.6.0 with foreman-proxy 1.6.0 and > still do not have any luck. > > Currently I am using Puppet 3.7.1. I am using the Puppet > 3.6.0 > configuration documented on this > page: https://github.com/adrienthebo/r10k/blob/master/doc/dynamic-environments/master-configuration.mkd > > When I run the "Import from " command it says there are > no changes. Interestingly enough I have an example_env and test > directory as well in there but it does not see them. > > When I go to create "New Puppet Environment" and name it something like > testenv. Then import again it will ask me to delete the environment. > > When I go to create "New Puppet Environment" and name it something like > test (where a folder already exists). Then import again it will say no > changes. > > If I move that folder to say test2 and do a reimport it will prompt me > to remove the test environment but will not ask me to add test2. > > Thanks, > Dan > > On Tuesday, August 5, 2014 3:35:02 AM UTC-4, Dominic Cleal wrote: > > On 04/08/14 18:54, Dan Cruver wrote: > > I tried setting up plain directory environments > > > (http://docs.puppetlabs.com/puppet/latest/reference/environments.html ) > > > by adding environmentpath = $confdir/environments to my > puppet.conf but > > forman would not pick up on my environment directories I created > unless > > I created ini entries for them like so: > > > > [production] > > modulepath = $confdir/environments/production/modules > > manifest = $confdir/environments/production/manifests > > > > [development] > > modulepath = $confdir/environments/development/modules > > manifest = $confdir/environments/development/manifests > > > > Puppet will ignore these when the environmentpath is defined but for > > some reason I need it for foreman to discover it. > > Ensure you have foreman-proxy 1.5.2, as this adds support for directory > environments. > > -- > Dominic Cleal > Red Hat Engineering > > -- > You received this message because you are subscribed to the Google > Groups "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to foreman-users+unsubscribe@googlegroups.com > . > To post to this group, send email to foreman-users@googlegroups.com > . > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout.


Dominic Cleal
Red Hat Engineering

I am soon going to wipe my foreman database because I haven't done much
with it yet so history is not really a concern with me. But here is my
/etc/puppet/ directory:

.
├── auth.conf
├── autosign.conf
├── environments
│ ├── common
│ ├── development
│ │ ├── manifests
│ │ └── modules
│ ├── example_env
│ │ ├── manifests
│ │ ├── modules
│ │ └── README.environment
│ ├── production
│ │ ├── manifests
│ │ │ └── site.pp
│ │ └── modules
│ └── test
│ ├── environment.conf
│ ├── Puppetfile
│ └── site.pp
├── fileserver.conf
├── foreman.yaml
├── manifests
│ ├── extdata
│ └── site.pp
├── modules
├── node.rb
├── puppet.conf
└── rack
├── config.ru
├── public
└── tmp
└── restart.txt

The modules are empty because I was in the process of setting up r10k but
relized directory environments were not being auto detected. I have
attached my current configuration with some censoring for domain name.

puppet.conf (1.64 KB)

··· On Wednesday, October 1, 2014 4:12:55 AM UTC-4, Dominic Cleal wrote: > > It sounds like either the proxy isn't detecting the existence of those > environments at all, or they're empty. > > Can you share your current puppet.conf config please? Also can you show > the on-disk layout (tree /etc/puppet) and confirm whether you have any > modules and Puppet classes inside those environments. > > Regarding the counters you mentioned in the second reply, that's a known > issue and is harmless (http://projects.theforeman.org/issues/5692), > we're addressing it for 1.6.1. > > Cheers, > Dominic > > On 30/09/14 21:24, Dan Cruver wrote: > > At the time of writing I believe I was using atleast foreman-proxy 1.5.2 > > but since have also update to foreman 1.6.0 with foreman-proxy 1.6.0 and > > still do not have any luck. > > > > Currently I am using Puppet 3.7.1. I am using the Puppet > 3.6.0 > > configuration documented on this > > page: > https://github.com/adrienthebo/r10k/blob/master/doc/dynamic-environments/master-configuration.mkd > > > > When I run the "Import from " command it says there are > > no changes. Interestingly enough I have an example_env and test > > directory as well in there but it does not see them. > > > > When I go to create "New Puppet Environment" and name it something like > > testenv. Then import again it will ask me to delete the environment. > > > > When I go to create "New Puppet Environment" and name it something like > > test (where a folder already exists). Then import again it will say no > > changes. > > > > If I move that folder to say test2 and do a reimport it will prompt me > > to remove the test environment but will not ask me to add test2. > > > > Thanks, > > Dan > > > > On Tuesday, August 5, 2014 3:35:02 AM UTC-4, Dominic Cleal wrote: > > > > On 04/08/14 18:54, Dan Cruver wrote: > > > I tried setting up plain directory environments > > > > > ( > http://docs.puppetlabs.com/puppet/latest/reference/environments.html < > http://docs.puppetlabs.com/puppet/latest/reference/environments.html>) > > > > > by adding environmentpath = $confdir/environments to my > > puppet.conf but > > > forman would not pick up on my environment directories I created > > unless > > > I created ini entries for them like so: > > > > > > [production] > > > modulepath = $confdir/environments/production/modules > > > manifest = $confdir/environments/production/manifests > > > > > > [development] > > > modulepath = $confdir/environments/development/modules > > > manifest = $confdir/environments/development/manifests > > > > > > Puppet will ignore these when the environmentpath is defined but > for > > > some reason I need it for foreman to discover it. > > > > Ensure you have foreman-proxy 1.5.2, as this adds support for > directory > > environments. > > > > -- > > Dominic Cleal > > Red Hat Engineering > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Foreman users" group. > > To unsubscribe from this group and stop receiving emails from it, send > > an email to foreman-user...@googlegroups.com > > <mailto:foreman-users+unsubscribe@googlegroups.com >. > > To post to this group, send email to forema...@googlegroups.com > > > <mailto:forema...@googlegroups.com >. > > Visit this group at http://groups.google.com/group/foreman-users. > > For more options, visit https://groups.google.com/d/optout. > > > -- > Dominic Cleal > Red Hat Engineering >

Dan,

AKAIK rerunning the foreman installer is fine since it is indeed idempotent
as it uses Puppet, which is idempotent. The beauty of that is you can use
your answer file to set parameter values for foreman Puppet modules to
continue managing foreman after initial setup.

I'll send configs once at my office. I'm using
https://forge.puppetlabs.com/zack/r10k to setup r10k across 2 masters and 1
head node that puts modules and hiera on NFS used by masterless puppet
apply. I can't expose repos to public (yet) but can send sanitized configs.

  • Trey
··· On Oct 1, 2014 8:20 AM, "Dan Cruver" wrote:

Thank you very much if I hit a dead end I will want to do this. I don’t
have much history and just in the setup phase so some of the reports are
not even useful going forward. From your response to start from “Initial
Setup” i do not need to run foreman-installer again but is there harm doing
so. I would be just using my existing answer file to run it again. I have
done this in the past and as far as I can tell the foreman-installer is
idempotent assuming you don’t change the answer file or other configuration
files after install.

Could I have a copy of your r10k and heira configurations? I would like
to set it up so their is a git repo for environments and a separate one for
heira.

On Tuesday, September 30, 2014 8:39:57 PM UTC-4, treydock wrote:

If you really want to start from scratch, you’ll have to drop the
database and recreate it using Rails. Something like the following - note
this will wipe out your entire Foreman database, so as “scratch” as it gets.

foreman-rake db:drop

Then follow Foreman :: Manual.
1InitialSetup

The host and reports are all in the database. Wiping that out will start
you from scratch.

As for using environments, I don’t use directory environments as I’m
still on 1.5.1 and I don’t pull my Puppet classes into Foreman. I use r10k
to deploy my modules and hiera. Hiera is used to provide class assignment
and parameter values. Foreman does everything else including provides the
host’s environment.

[master]
autosign = $confdir/autosign.conf { mode = 664 }
reports = foreman
external_nodes = /etc/puppet/node.rb
node_terminus = exec
ca = true
ssldir = /var/lib/puppet/ssl
certname = puppetmaster01.DOMAIN
storeconfigs = true
storeconfigs_backend = puppetdb
strict_variables = false

manifest       = /etc/puppet/environments/$

environment/manifests/site.pp
modulepath = /etc/puppet/environments/$environment/modules
config_version =

That is done via the Puppet module provided by https://forge.puppetlabs.
com/theforeman/puppet.

On Tue, Sep 30, 2014 at 4:18 PM, Dan Cruver ddcr...@gmail.com wrote:

I believe my Foreman may be in a bad state.

Under environments I have two but the counts are wrong.
I should have 1 development machine and 12 production machines.

development
https://puppet.cmif.cubrc.org/environments/development/edit-1
https://puppet.cmif.cubrc.org/hosts?search=environment+%3D+development
Classes
https://puppet.cmif.cubrc.org/puppetclasses?search=environment+%3D+development
https://puppet.cmif.cubrc.org/environments#
production https://puppet.cmif.cubrc.org/environments/production/edit
14
https://puppet.cmif.cubrc.org/hosts?search=environment+%3D+productionIs
there a way I can clean up all reports and information about all machines
and start from scratch. I tried using foreman-installer again but guess
because it uses puppet it most likely detects certain files exist and
doesn’t modify them.
On Tuesday, August 5, 2014 3:35:02 AM UTC-4, Dominic Cleal wrote:

On 04/08/14 18:54, Dan Cruver wrote:

I tried setting up plain directory environments
(http://docs.puppetlabs.com/puppet/latest/reference/environments.html)

by adding environmentpath = $confdir/environments to my puppet.conf
but
forman would not pick up on my environment directories I created
unless
I created ini entries for them like so:

[production]
modulepath = $confdir/environments/production/modules
manifest = $confdir/environments/production/manifests

[development]
modulepath = $confdir/environments/development/modules
manifest = $confdir/environments/development/manifests

Puppet will ignore these when the environmentpath is defined but for
some reason I need it for foreman to discover it.

Ensure you have foreman-proxy 1.5.2, as this adds support for directory
environments.


Dominic Cleal
Red Hat Engineering


You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/foreman-users/O3SlFQquRTg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
foreman-user...@googlegroups.com.
To post to this group, send email to forema...@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/foreman-users/O3SlFQquRTg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Dan,

/etc/r10k.yaml:
:cachedir: /var/cache/r10k
:sources:
hiera:
basedir: /etc/puppet/hiera
remote: git@github.tamu.edu:treydock/brazos_hieradata.git
puppet:
basedir: /etc/puppet/environments
remote: git@github.tamu.edu:treydock/brazos-master-conf.git

:purgedirs:

  • /etc/puppet/environments

Structure of brazos-master-conf:

/etc/puppet/environments/production
├── Gemfile
├── .git
├── .gitignore
├── manifests – Contains site.pp , used by master and masterless
├── modules
├── node.rb – Used by masterless Puppet
├── puppet.conf – Used by masterless Puppet
├── puppetdb.conf-- Used by masterless Puppet
├── Puppetfile

Structure of brazos_hieradata:

/etc/puppet/hiera/production
├── Gemfile
├── .git
├── .gitignore
├── hieradata
├── hiera.yaml
└── Rakefile

/etc/puppet/puppet.conf (comments and domain removed):
[main]
logdir = /var/log/puppet
rundir = /var/run/puppet
ssldir = $vardir/ssl
privatekeydir = $ssldir/private_keys { group = service }
hostprivkey = $privatekeydir/$certname.pem { mode = 640 }
autosign = $confdir/autosign.conf { mode = 664 }
show_diff = true
ca_server = puppetca.DOMAIN
hiera_config = /etc/puppet/hiera/production/hiera.yaml
dns_alt_names = puppet,puppet.DOMAIN,puppetmaster,puppetmaster.DOMAIN
,puppetca,puppetca.DOMAIN

[agent]
classfile = $statedir/classes.txt
localconfig = $vardir/localconfig

default_schedules = false

report        = true
pluginsync    = true
masterport    = 8140
environment   = production
certname      = puppetmaster01.DOMAIN
server        = puppet.DOMAIN
listen        = false
splay         = false
runinterval   = 3600
noop          = false
configtimeout = 120

[master]
autosign = $confdir/autosign.conf { mode = 664 }
reports = foreman
external_nodes = /etc/puppet/node.rb
node_terminus = exec
ca = true
ssldir = /var/lib/puppet/ssl
certname = puppetmaster01.DOMAIN
storeconfigs = true
storeconfigs_backend = puppetdb
strict_variables = false

manifest       = /etc/puppet/environments/$environment/manifests/site.pp
modulepath     = /etc/puppet/environments/$environment/modules
config_version =

/etc/puppet/puppetdb.conf (for completeness):

[main]
port = 8081
soft_write_failure = false
server = puppetdb.DOMAIN

/etc/puppet/hiera/production/hiera.yaml

··· --- :backends: - yaml - puppetdb :logger: console :hierarchy: - "fqdn/%{::fqdn}" - "%{::hostgroup}" - "infiniband_%{::has_infiniband}" - "public_facing_%{::public_facing}" - "%{::osfamily}%{::operatingsystemmajrelease}" - common - common/packages - common/site

:yaml:
:datadir: “/etc/puppet/hiera/%{::environment}/hieradata”

Due to either a bug or normal behavior in Puppet only one environment’s
hiera.yaml can be used, so all my environments have the same hiera.yaml,
but the data in hieradata varies. Also changes to hiera.yaml require a
restart of Puppet master. I am using 3.6.2 so may not be an issue in newer
version of Puppet.

Also note that I use the hostgroup defined by Foreman (exposed as top-scope
variable via Foreman ENC) to structure my hiera data. So I would have
something like

base/compute == hieradata/base/compute.yaml
base/head == hieradata/base/head.yaml
base/mgmt/dns = hieradata/base/mgmt/dns.yaml

Some of the facts are from modules I have yet to publish in the Forge, and
some facts in that hiera.yaml are from modules I need to sanitize before
publishing on Github or the Forge (ie public_facing).

My Puppet configuration is handled by theforeman-puppet, though I’m using a
forked version but my changes may have been merged, haven’t had time to
check :slight_smile:

The r10k configuration is via zack/r10k as mentioned previously, and I use
that module’s mcollective plugin to sync my Puppet masters, which is
extremely handy.

  • Trey

On Wed, Oct 1, 2014 at 8:20 AM, Dan Cruver ddcruver@gmail.com wrote:

Thank you very much if I hit a dead end I will want to do this. I don’t
have much history and just in the setup phase so some of the reports are
not even useful going forward. From your response to start from “Initial
Setup” i do not need to run foreman-installer again but is there harm doing
so. I would be just using my existing answer file to run it again. I have
done this in the past and as far as I can tell the foreman-installer is
idempotent assuming you don’t change the answer file or other configuration
files after install.

Could I have a copy of your r10k and heira configurations? I would like
to set it up so their is a git repo for environments and a separate one for
heira.

On Tuesday, September 30, 2014 8:39:57 PM UTC-4, treydock wrote:

If you really want to start from scratch, you’ll have to drop the
database and recreate it using Rails. Something like the following - note
this will wipe out your entire Foreman database, so as “scratch” as it gets.

foreman-rake db:drop

Then follow Foreman :: Manual.
1InitialSetup

The host and reports are all in the database. Wiping that out will start
you from scratch.

As for using environments, I don’t use directory environments as I’m
still on 1.5.1 and I don’t pull my Puppet classes into Foreman. I use r10k
to deploy my modules and hiera. Hiera is used to provide class assignment
and parameter values. Foreman does everything else including provides the
host’s environment.

[master]
autosign = $confdir/autosign.conf { mode = 664 }
reports = foreman
external_nodes = /etc/puppet/node.rb
node_terminus = exec
ca = true
ssldir = /var/lib/puppet/ssl
certname = puppetmaster01.DOMAIN
storeconfigs = true
storeconfigs_backend = puppetdb
strict_variables = false

manifest       = /etc/puppet/environments/$

environment/manifests/site.pp
modulepath = /etc/puppet/environments/$environment/modules
config_version =

That is done via the Puppet module provided by https://forge.puppetlabs.
com/theforeman/puppet.

On Tue, Sep 30, 2014 at 4:18 PM, Dan Cruver ddcr...@gmail.com wrote:

I believe my Foreman may be in a bad state.

Under environments I have two but the counts are wrong.
I should have 1 development machine and 12 production machines.

development
https://puppet.cmif.cubrc.org/environments/development/edit-1
https://puppet.cmif.cubrc.org/hosts?search=environment+%3D+development
Classes
https://puppet.cmif.cubrc.org/puppetclasses?search=environment+%3D+development
https://puppet.cmif.cubrc.org/environments#
production https://puppet.cmif.cubrc.org/environments/production/edit
14
https://puppet.cmif.cubrc.org/hosts?search=environment+%3D+productionIs
there a way I can clean up all reports and information about all machines
and start from scratch. I tried using foreman-installer again but guess
because it uses puppet it most likely detects certain files exist and
doesn’t modify them.
On Tuesday, August 5, 2014 3:35:02 AM UTC-4, Dominic Cleal wrote:

On 04/08/14 18:54, Dan Cruver wrote:

I tried setting up plain directory environments
(http://docs.puppetlabs.com/puppet/latest/reference/environments.html)

by adding environmentpath = $confdir/environments to my puppet.conf
but
forman would not pick up on my environment directories I created
unless
I created ini entries for them like so:

[production]
modulepath = $confdir/environments/production/modules
manifest = $confdir/environments/production/manifests

[development]
modulepath = $confdir/environments/development/modules
manifest = $confdir/environments/development/manifests

Puppet will ignore these when the environmentpath is defined but for
some reason I need it for foreman to discover it.

Ensure you have foreman-proxy 1.5.2, as this adds support for directory
environments.


Dominic Cleal
Red Hat Engineering


You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/foreman-users/O3SlFQquRTg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
foreman-user...@googlegroups.com.
To post to this group, send email to forema...@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/foreman-users/O3SlFQquRTg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Right, that's probably why Foreman's deleting the environments when
trying to do an import - because they're empty.

It can't distinguish between a dir/environment existing + being empty
versus a dir/environment being missing.

Once you've got r10k set up and the environments populated, it should work.

··· -- Dominic Cleal Red Hat Engineering

On 01/10/14 14:13, Dan Cruver wrote:

I am soon going to wipe my foreman database because I haven’t done much
with it yet so history is not really a concern with me. But here is my
/etc/puppet/ directory:

.
├── auth.conf
├── autosign.conf
├── environments
│ ├── common
│ ├── development
│ │ ├── manifests
│ │ └── modules
│ ├── example_env
│ │ ├── manifests
│ │ ├── modules
│ │ └── README.environment
│ ├── production
│ │ ├── manifests
│ │ │ └── site.pp
│ │ └── modules
│ └── test
│ ├── environment.conf
│ ├── Puppetfile
│ └── site.pp
├── fileserver.conf
├── foreman.yaml
├── manifests
│ ├── extdata
│ └── site.pp
├── modules
├── node.rb
├── puppet.conf
└── rack
├── config.ru
├── public
└── tmp
└── restart.txt

The modules are empty because I was in the process of setting up r10k
but relized directory environments were not being auto detected. I have
attached my current configuration with some censoring for domain name.

On Wednesday, October 1, 2014 4:12:55 AM UTC-4, Dominic Cleal wrote:

It sounds like either the proxy isn't detecting the existence of those
environments at all, or they're empty.

Can you share your current puppet.conf config please?  Also can you
show
the on-disk layout (tree /etc/puppet) and confirm whether you have any
modules and Puppet classes inside those environments.

Regarding the counters you mentioned in the second reply, that's a
known
issue and is harmless (http://projects.theforeman.org/issues/5692
<http://projects.theforeman.org/issues/5692>),
we're addressing it for 1.6.1.

Cheers,
Dominic

On 30/09/14 21:24, Dan Cruver wrote:
> At the time of writing I believe I was using atleast foreman-proxy
1.5.2
> but since have also update to foreman 1.6.0 with foreman-proxy
1.6.0 and
> still do not have any luck.
>
> Currently I am using Puppet 3.7.1.  I am using the Puppet > 3.6.0
> configuration documented on this
> page:
https://github.com/adrienthebo/r10k/blob/master/doc/dynamic-environments/master-configuration.mkd
<https://github.com/adrienthebo/r10k/blob/master/doc/dynamic-environments/master-configuration.mkd>

>
> When I run the "Import from <puppet-master>" command it says there
are
> no changes.  Interestingly enough I have an example_env and test
> directory as well in there but it does not see them.
>
> When I go to create "New Puppet Environment" and name it something
like
> testenv. Then import again it will ask me to delete the environment.
>
> When I go to create "New Puppet Environment" and name it something
like
> test (where a folder already exists). Then import again it will
say no
> changes.
>
> If I move that folder to say test2 and do a reimport it will
prompt me
> to remove the test environment but will not ask me to add test2.
>
> Thanks,
> Dan
>
> On Tuesday, August 5, 2014 3:35:02 AM UTC-4, Dominic Cleal wrote:
>
>     On 04/08/14 18:54, Dan Cruver wrote:
>     > I tried setting up plain directory environments
>     >
>    
(http://docs.puppetlabs.com/puppet/latest/reference/environments.html <http://docs.puppetlabs.com/puppet/latest/reference/environments.html>
<http://docs.puppetlabs.com/puppet/latest/reference/environments.html <http://docs.puppetlabs.com/puppet/latest/reference/environments.html>>)

>
>     > by adding environmentpath = $confdir/environments to my
>     puppet.conf but
>     > forman would not pick up on my environment directories I
created
>     unless
>     > I created ini entries for them like so:
>     >
>     > [production]
>     >   modulepath = $confdir/environments/production/modules
>     >   manifest = $confdir/environments/production/manifests
>     >
>     > [development]
>     >   modulepath = $confdir/environments/development/modules
>     >   manifest = $confdir/environments/development/manifests
>     >
>     > Puppet will ignore these when the environmentpath is defined
but for
>     > some reason I need it for foreman to discover it.
>
>     Ensure you have foreman-proxy 1.5.2, as this adds support for
directory
>     environments.
>
>     --
>     Dominic Cleal
>     Red Hat Engineering
>
> --
> You received this message because you are subscribed to the Google
> Groups "Foreman users" group.
> To unsubscribe from this group and stop receiving emails from it,
send
> an email to foreman-user...@googlegroups.com <javascript:>
> <mailto:foreman-users+unsubscribe@googlegroups.com <javascript:>>.
> To post to this group, send email to forema...@googlegroups.com
<javascript:>
> <mailto:forema...@googlegroups.com <javascript:>>.
> Visit this group at http://groups.google.com/group/foreman-users
<http://groups.google.com/group/foreman-users>.
> For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.


-- 
Dominic Cleal
Red Hat Engineering


You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-users+unsubscribe@googlegroups.com
mailto:foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com
mailto:foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.