pretty sure there was one but couldnt find it so I just knocked up a quick test, this has been discussed to death in the past
.
├── development
│ ├── modules
│ │ └── test
│ │ ├── files
│ │ │ └── envtest
│ │ └── manifests
│ │ └── init.pp
│ └── site.pp
├── production
│ ├── modules
│ │ └── test
│ │ ├── files
│ │ │ └── envtest
│ │ └── manifests
│ │ └── init.pp
│ └── site.pp
├── puppet.conf
└── test.pp
test.pp has: include test
production init.pp has:
class test {
notify{"production test": }
file{"/tmp/envtest":
source =>"puppet:///modules/test/envtest"
}
}
development just changed the notify
when running with --enviornment this works:
% puppet apply --config puppet.conf --environment development test.pp
notice: development test
notice: /Stage[main]/Test/Notify[development test]/message: defined 'message' as 'development test'
notice: /Stage[main]/Test/File[/tmp/envtest]/ensure: defined content as '{md5}e42d5f60192d1f8f94ce446fff3113b0'
notice: Finished catalog run in 0.03 seconds
% cat /tmp/envtest
development
% puppet apply --config puppet.conf --environment production test.pp
notice: /Stage[main]/Test/File[/tmp/envtest]/content: content changed '{md5}e42d5f60192d1f8f94ce446fff3113b0' to '{md5}6f03617bce8a5d04fe97df572f273d05'
notice: production test
notice: /Stage[main]/Test/Notify[production test]/message: defined 'message' as 'production test'
notice: Finished catalog run in 0.03 seconds
% cat /tmp/envtest
production
same with a fact and here i am getting development code with production files:
% FACTER_environment=development puppet apply --config puppet.conf test.pp
notice: development test
notice: /Stage[main]/Test/Notify[development test]/message: defined 'message' as 'development test'
notice: Finished catalog run in 0.02 seconds
% cat /tmp/envtest
production