add user to certain hosts

22 views
Skip to first unread message

Philippe Conway

unread,
Mar 13, 2014, 2:33:48 PM3/13/14
to puppet...@googlegroups.com
Hey Guys,

I am wanting to add certain users to certain hosts. I was thinking of listing it in my users module. Here is an example:

 user {'llane':
    if $fqdn = 'node1.example.com' {
      ensure => present,
    }else{
      ensure => absent,
    }
    home       => '/home/llane',
    managehome => true,
    uid        => '1003',
    shell      => '/bin/bash',
    comment    => 'Lois Lane',
  }

Basically looking to add Lois Lane to ONLY node1.example.com.

However Puppet is saying I can't do it because of a syntax error. To me the code looks correct, but I may be just tired and not noticing the error. Any suggestions? Thanks

- Philippe

Peter Bukowinski

unread,
Mar 13, 2014, 4:01:41 PM3/13/14
to puppet...@googlegroups.com
You may already be aware that putting node-specific logic in your puppet manifests is not a best practice, but I'll help you with the syntax error. Your if conditional needs to use '==' to test the fact value, not a single equal which is used for assigning values.

--
Peter Bukowinski

Philippe Conway

unread,
Mar 13, 2014, 4:04:59 PM3/13/14
to puppet...@googlegroups.com
Thanks Peter I'll give that a shot.

I'm still a noob to Puppet, but yeah I'm aware putting in node-specific logic in our manifests is not best practice. Still trying to figure out a way I could do what I'm trying to do.

Thanks again sir.

- Philippe
Reply all
Reply to author
Forward
0 new messages