One way is to override it from the environments/some-env.rb file.
But I think to look its values later, I’ll have to re-map opening
individual env files.
It would be better if I could just add it in the roles file per env like
Is this already in chef or any plugins?
The way we deal with it is to create a cookbook/recipe per role. So we
would introduce a cookbook named “mybiz-ftpserver”. Then have it do any of
the environment specific logic before including the relevant recipes.
if node.environment == 'production’
node.override[‘vsftpd’][‘chroot_users’] = [“ftpuser”]
node.override[‘vsftpd’][‘chroot_users’] = [“other_ftpuser”]
And then the role would look something like
That way all the logic you want for environment specific customisation is
explicit in a cookbook and relatively easy to understand.