Ask Your Question

Unknown resource type: 'file_line'

asked 2018-04-13 04:48:04 -0600

HerrFried gravatar image

updated 2018-04-13 11:13:05 -0600

Hi all,

in one of my module I have create a user and I want to add it to a sudoers file. I use the 'file_line' statement to do that.

file_line { 'myuser': path => '/etc/sudoers.d/mycompany_users', line => 'myuser ALL=(ALL) NOPASSWD:ALL', tag => ['base'] }

When I execute the manifest I get this error

Error: Evaluation Error: Error while evaluating a Resource Statement, Unknown resource type: 'file_line' (file: /media/ephemeral0/repo-git/puppet/manifests/node.pp, line: 32, column: 1)

I execute puppet with this command

puppet apply /path/to/my/manifet.pp --modulepath=/path/to/my/modules --tags base

I have the stdlib module in the modulepath. Can someone help me troubleshoot this error?


edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2018-04-16 02:36:27 -0600

luksi1 gravatar image

Your running into an XY problem here. I'll deal with the "Y" problem first, then the "X" problem.

You almost certainly do not have stdlib in your modulepath. My guess is, you cloned stdlib into your puppet modules directory and you have a "puppet-stdlb" directory. That directory will NOT get parsed as the module name needs to be "stdlib", meaning the directory MUST BE "stdlib" as well. Run a simple "ls" in the directory "--modulepath" points to. Do you have a directory "stdlib"?

On to the "X" problem. You are trying to add users with sudo permissions, but you are trying to add them directly to the sudoers file, which is understandable. I believe visudo edits sudoers directly in all major distros. But in all major distros, you'll find a /etc/sudoers.d directory to solve precisely this problem. Add your users to the this directory with Puppet. This will allow you to give Puppet complete control over this file (or directory if you choose to use the tidy resource) and it will leave the sudoers.conf alone, allowing for easier upgrades in the future, and much more readable code in your manifests.

edit flag offensive delete link more


Hi luksi1, thanks for your answer. I'll reply point by point to be clearer. Starting with the Y problem, the name of the directory is the first thing I check, and in the modulepath there is the a folder called simply 'stdlib'.

HerrFried gravatar imageHerrFried ( 2018-04-17 11:34:01 -0600 )edit

On the X problem instead, I explained myself poorly in the question, I was already adding the line to a file inside the sudoers.d folder exactly to avoid the issue you described, so I guess permissions are not the reason of the error. Thanks for your help!

HerrFried gravatar imageHerrFried ( 2018-04-17 11:35:16 -0600 )edit

answered 2018-04-16 02:09:39 -0600

HerrFried gravatar image

Hi lupin,

thanks for your answer! Here is the output of the command:

basemodulepath = /etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules module_groups = module_repository = module_skeleton_dir = /opt/puppetlabs/puppet/cache/puppet-module/skeleton module_working_dir = /opt/puppetlabs/puppet/cache/puppet-module modulepath = /etc/puppetlabs/code/environments/production/modules:/etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules

I am passing as an argument a custom modulepath with the stdlib inside, is it ignored? By the way I have also tried to copy the modules into one of the directory listed and I still get the same error. Am I doing something wrong here?


edit flag offensive delete link more



See my comment to lupin's answer below. "--modulepath" will override your default path. "puppet config print" will have no bearing on your "puppet apply" in this case.

luksi1 gravatar imageluksi1 ( 2018-04-16 02:38:59 -0600 )edit

Saw it thanks!

HerrFried gravatar imageHerrFried ( 2018-04-17 11:35:44 -0600 )edit

answered 2018-04-15 14:27:02 -0600

lupin gravatar image

In the client and server node, where is your module path pointed? Can you find the stdlib module inside that directories?

puppet config print | grep module

Will give you the output.

edit flag offensive delete link more


"puppet config print | grep module" will print the module directory for the current puppet configuration. If he adds "--modulepath" then he changes the default module directory, making "puppet config print" invalid.

luksi1 gravatar imageluksi1 ( 2018-04-16 02:22:03 -0600 )edit

I knew what that command does. All I wanted is to see if he has the correct module path and if the stdlib module exists in those directories.

lupin gravatar imagelupin ( 2018-04-17 04:40:16 -0600 )edit

But that would have been pointless, as he overrode the modulepath with his puppet apply. If you run "puppet config print | grep module" it will print your current modulepath. If you run "puppet apply --modulepath=/tmp/modules" you will then have a different module path.

luksi1 gravatar imageluksi1 ( 2018-04-17 04:50:27 -0600 )edit

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: 2018-04-13 04:48:04 -0600

Seen: 730 times

Last updated: Apr 16