Ask Your Question

Puppet Local Account Creation and Exec Resource

asked 2016-09-23 02:43:22 -0600

Shivayogi gravatar image
user { 'acc1': 
ensure => present, 
managehome => true, 
password => 'Test123', 
groups => ['Administrators'], 
auth_membership => 'minimum', 
notify => Exec['app config'] 

exec { 'app config':
path        => 'c:\\program files (x86)\\app\\bin',
command     => 'config.bat -f responsefile.rsp',
refreshonly => true

The user is getting created, but I need the local account to be used for the app configuration.

The above puppet script is executed by domain account(abc\myname), and the application requires a local account to be used for the configuration.

So I have created a local account through puppet and using notify to tell exec to use the account created by the puppet. But when it is executed, the application is throwing error: "need a local account or administrator"

In logs it is giving the myname is not a local account or administrator.

I see that exec is not using the local user acc1 created by puppet.

Is there any other way where in I can direct the exec to user a particular local user account to use for configuration.

Please advise.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-09-23 05:58:33 -0600

Emerson Prado gravatar image

updated 2016-09-23 18:39:07 -0600

DarylW gravatar image

The exec resource has an attibute called user:

exec { 'app config':  
  user => 'acct1',  
edit flag offensive delete link more



I did finish the code lines with double spaces to break lines, and the preview did show lines correctly. Just have no idea on how to make the lines apply to the finished comment. So pls imagine the ellipsis and the user directive in their own lines.

Emerson Prado gravatar imageEmerson Prado ( 2016-09-23 06:02:14 -0600 )edit

I fixed your formatting for you. It uses an indentation based 'code' indicator. I usually write out my code, Select it all, and then hit the button with 0's ans 1's in it.

DarylW gravatar imageDarylW ( 2016-09-23 18:40:10 -0600 )edit

Used the attribute "User" , but getting the below error: Puppet(err) : Parameter user failed on Exec[app config] : Unable to execute command as other users on Windows at D:\Provisioning\modules\appconfig\manifests\init.pp

Shivayogi gravatar imageShivayogi ( 2016-09-25 23:25:30 -0600 )edit

@Shivayogi I've just found out that Puppet just can't do it yet on Windows. There is an open ticket requesting such feature: I recommend you subscribing yourself as a watcher and/or vote for this ticket.

Emerson Prado gravatar imageEmerson Prado ( 2017-04-10 12:13:33 -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

1 follower


Asked: 2016-09-23 02:43:22 -0600

Seen: 83 times

Last updated: Sep 23 '16