Using ignored_environments.yml to blacklist folder containing modules

Hello,

my puppet master has some common classes installed in
/etc/puppet/modules witch are really only dependency modules like
'stdlib'from puppet-forge. Right now, I use ignored_environments.yml and
put in a regex for every single of those moduleswitch works well but is
cumbersome.
But when I put in a path, it does not seem to work.

Question: is there a way to ignore a full path containing modules in
foreman?

Thanks!

··· -- Daniel Helgenberger Schivelbeiner Str. 46 10439 Berlin

Hi,

I’m new to foreman and have now the same problem/issue as you in the past.
Did you find a solution ?

Best regards

Hi,

Hello,

it is doable using ruby regex in environments.yml. There are some examples already in the default file, just have a look.

Hi,

I tried it, but it didn’t work for me:

:ignored:

  • common

All modules in environment common are imported.

Do you have an idea why ?

Best regards

Martin

Martin,

i can confirm this works (also ignoring common).

Pls read up on docs. Also, you might need to restart foreman (httpd) after modifing ignored envs.

Hi Daniel,

sorry, for me it didn’t work. Filters are working as expected, but
environments are imported.

My ignored_environments.yml:

[root@support ~]# cat /etc/foreman/ignored_environments.yml
:ignored:
   - common
[root@support ~]#
[root@support ~]# ls -al /etc/puppetlabs/code/environments/
insgesamt 20
drwxr-s--- 5 puppet puppet 4096 28. Mär 13:39 .
drwxr-s--- 4 puppet puppet 4096 28. Mär 20:03 .. 
drwxrws--- 3 puppet puppet 4096 14. Apr 18:52 common 
drwxrws--- 4 puppet puppet 4096 14. Apr 21:06 development 
drwxrws--- 4 puppet puppet 4096 14. Apr 21:02 production 
[root@support ~]#
[root@support ~]# ls -al /usr/share/foreman/config/ignored_environments.yml
lrwxrwxrwx 1 root root 37 26. Mär 12:15     /usr/share/foreman/config/ignored_environments.yml ->  /etc/foreman/ignored_environments.yml
[root@support ~]#

Maybe you have some hints for debugging ?

Best regards

Martin

Hello Martin,

maybe there is some basic puppet stuff you are not aware of: The common env is special in a way all it’s classes are showing up in other envs as well (hence, the name). Ignoring common itself is not enough, you need to :filer: out the names as well. Below is mine, btw.

:ignored:
  - common
:filters:
  - !ruby/regexp '/::params$/'
  - !ruby/regexp '/::base$/'
  - !ruby/regexp '/::install$/'
  - !ruby/regexp '/::service$/'
  - !ruby/regexp '/::config$/'
  - !ruby/regexp '/wget$/'
  - !ruby/regexp '/stdlib/'
  - !ruby/regexp '/acl$/'
  - !ruby/regexp '/iis$/'
  - !ruby/regexp '/concat/'
  - !ruby/regexp '/registry/'
  - !ruby/regexp '/inifile$/'
  - !ruby/regexp '/windows_services$/'
  - !ruby/regexp '/mblib$/'
  - !ruby/regexp '/homebrew/'
  - !ruby/regexp '/apt/'
  - !ruby/regexp '/chocolatey/'
  - !ruby/regexp '/^puppet_agent::/'
  - !ruby/regexp '/^nats::/'
  - !ruby/regexp '/^mcollective::/'
  - !ruby/regexp '/^mcollective_a/'
  - !ruby/regexp '/^mcollective_u/'

Hello Daniel,

oh, indeed that is a new information for me. I overlooked this.

I will try to create a new environment because I would not maintain the
filter list.

Thank you for the explanation.

Best regards

Martin

Hi Daniel,

I renamed common to internal, but still the same: all modules in
internal will be imported.

So the only solution seems to maintain the filters, it’s a pity.

Best regards

Martin