Ask Your Question

Could not retrieve information from environment production

asked 2016-01-05 06:35:42 -0600

SPQRInc gravatar image

I followed the video tutorial at to get a basic example of using puppet to deploy sshd_config to different hosts.

This is my "module":

|-- files
|   |-- sshd_config.Debian
|   `-- sshd_config.Ubuntu
`-- manifests
    `-- init.pp

cat manifests/init.pp shows my manifest:

class ssh_config {
    package { 
            ensure => latest,
    file    {   
            ensure      =>  'present',
            owner       =>  'root',
            group       =>  'root',
            mode        =>  '0644',
            source      =>  'puppet:///modules/ssh_config/sshd_config.${operatingsystem}',
            require     =>  Package['openssh-server'],
            notify      =>  Service['ssh']
    service {
            ensure      =>  'running',
            enable      =>  'true',
            require     =>  Package['openssh-server'],

I included this into my /etc/puppet/manifest/site.pp:

node default {
        include ssh_config

If I run puppet agent -t I'm getting the following error:

Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for puppet
Info: Applying configuration version '1451986609'
Error: /Stage[main]/Ssh_config/File[/etc/ssh/sshd_config]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///modules/ssh_config/sshd_config.${operatingsystem}
Notice: /Stage[main]/Ssh_config/Service[ssh]: Dependency File[/etc/ssh/sshd_config] has failures: true
Warning: /Stage[main]/Ssh_config/Service[ssh]: Skipping because of failed dependencies
Notice: Finished catalog run in 0.13 seconds

Factor shows a result for facter operatingsystem

Puppet-Master: Ubuntu

Puppet-Agent: Ubuntu

What am I doing wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-05 12:28:59 -0600

GregLarkin gravatar image

Whenever you reference a variable inside a quoted string (e.g. interpolation), you have to make sure to surround said string with double quotes instead of single quotes. When you do that, the variable's value will be inserted.

One other style note - I strongly suggest referencing fact values as ${::operatingsystem} instead of ${operatingsystem} in order to reduce ambiguity about use of a fact vs. a normal variable.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2016-01-05 06:35:42 -0600

Seen: 1,773 times

Last updated: Jan 05 '16