Lord-Y
Lord-Y

Reputation: 157

Puppet environment: Parameter source failed on File

I have an issue with retrieving file from puppet agent. I'm running puppet master 3.7 version. Here is my structure:

.
|-- auth.conf
|-- environments
|   |-- dev
|   |   |-- environment.conf
|   |   |-- manifests
|   |   |   `-- site.pp
|   |   `-- modules
|   |       `-- common
|   |           |-- files
|   |           |   `-- profile
|   |           |-- manifests
|   |           |   `-- init.pp
|   |           `-- staticFiles
|   |               `-- profile
|   |-- prod
|   |   |-- environment.conf
|   |   |-- manifests
|   |   |   `-- site.pp
|   |   `-- modules
|   |       `-- common
|   |           `-- manifests
|   |               `-- init.pp
|   `-- uat
|       |-- environment.conf
|       |-- manifests
|       |   `-- site.pp
|       `-- modules
|           `-- common
|               `-- manifests
|                   `-- init.pp
|-- etckeeper-commit-post
|-- etckeeper-commit-pre
|-- fileserver.conf
|-- hieradata
|-- hiera.yaml
|-- manifests
|-- modules
|-- nodes
`-- puppet.conf

My config is with puppet environment prod,uat and dev. In dev environment I have:

manifest = /etc/puppet/environments/dev/manifests/site.pp
#modulepath = /etc/puppet/environments/dev/modules
modulepath = site:dist:modules:$basemodulepath

In a puppet client conf, I have: environment = dev basemodulepath=/etc/puppet/environments/$environment/modules

Here is my init common puppet module:

file { "/etc/profile":
        ensure => "file",
        mode    => 644,
        owner   => "root",
        group   => "root",
        require => Package["tree"],
        source => "puppet::///common/profile"
    }

On the node I got this error: Error: Failed to apply catalog: Parameter source failed on File[/etc/profile]: Cannot use opaque URLs 'puppet::///common/profile' at /etc/puppet/environments/dev/modules/common/manifests/init.pp:13 Wrapped exception: Cannot use opaque URLs 'puppet::///common/profile'

Even if I put source file like:

"puppet::///common/staticFiles/profile"
"puppet::///common/files/profile"
"puppet::///modules/common/profile"
"puppet::///modules/common/files/profile"
"puppet::///modules/common/staticFiles/profile"

I still got the same issue !

Do anyone know are to solve this issue? I really want to retrieve "profile" file in /etc/puppet/environments/dev/modules/common/files/ directory.

Here is also my puppet master conf content:

[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
prerun_command=/etc/puppet/etckeeper-commit-pre
postrun_command=/etc/puppet/etckeeper-commit-post
server = puppetmaster01
certname = puppetmaster01
environment = prod
condir = /etc/puppet
report = true
show_diff = true
trace = true
runinterval=60
environmentpath=$confdir/environments
#basemodulepath = $environmentpath/$environment/modules:/etc/puppet/modules:/usr/share/puppet/modules

[master]
# These are needed when the puppetmaster is run by passenger
# and can safely be removed if webrick is used.
ssl_client_header = SSL_CLIENT_S_DN 
ssl_client_verify_header = SSL_CLIENT_VERIFY
certname = puppetmaster01
#modulepath=$confdir/environments/$environment/modules:$confdir/modules

[agent]
report        = true
show_diff     = true

Upvotes: 0

Views: 2742

Answers (1)

Felix Frank
Felix Frank

Reputation: 8223

The URL

puppet:///modules/common/profile

should work. Please make sure that directory environments are in fact enabled on the master.

If this keeps failing consistently, please run

puppet agent --test --trace --verbose --debug

and paste the output on an appropriate service for review.

Upvotes: 1

Related Questions