Ask Your Question

Duplicate declaration: User already declared [closed]

asked 2015-05-25 17:55:30 -0500

peterz gravatar image

I have 3 apps (installed by 3 independent modules) that I need to run under the same user. I have this in each of the modules, I'm still getting the duplicate declaration error. Is there a way around this?

# Ensure user is created
  if defined(User[$user]) == false {
    usergroups::users { $user:
      before => File[$tmpdir],
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by peterz
close date 2015-06-03 14:03:06.681413

2 Answers

Sort by ยป oldest newest most voted

answered 2015-05-26 01:48:27 -0500

updated 2015-05-26 01:50:12 -0500

A user that's needed for several applications is a classic use-case for the virtual resources pattern:

As far as why defined doesn't work see:

edit flag offensive delete link more

answered 2015-06-03 14:02:44 -0500

peterz gravatar image

@Alex: I know about using virtual resources, but I had to use the already existing module that had some constraints. Your second link helped understanding and finding a workaround though, so thanks a lot!

Cheers, Peter

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-05-25 17:55:30 -0500

Seen: 816 times

Last updated: Jun 03 '15