How to specify multiple values for resource attribute from command line

109 views
Skip to first unread message

Paweł Sadowski

unread,
Oct 30, 2015, 10:31:10 AM10/30/15
to Puppet Users
Hello,

Is it possible to specify multiple attribute values from command line like below:

# puppet resource user root
user { 'root':
  ensure           => 'present',
  comment          => 'root',
  gid              => '0',
  home             => '/root',
  password_max_age => '99999',
  password_min_age => '0',
  shell            => '/bin/bash',
  uid              => '0',
}

# puppet resource user root groups='daemon'
Notice: /User[root]/groups: groups changed '' to 'daemon'
user { 'root':
  ensure => 'present',
  groups => ['daemon'],
}

# puppet resource user root
user { 'root':
  ensure           => 'present',
  comment          => 'root',
  gid              => '0',
  groups           => ['daemon'],
  home             => '/root',
  password_max_age => '99999',
  password_min_age => '0',
  shell            => '/bin/bash',
  uid              => '0',
}

# puppet resource user root groups='root,adm'
Error: Could not run: Parameter groups failed on User[root]: Group names must be provided as an array, not a comma-separated list.


Thanks,
PS

Will Hopper

unread,
Oct 30, 2015, 2:59:24 PM10/30/15
to Puppet Users
Hello,

Is it possible to specify multiple attribute values from command line like below:

# puppet resource user root groups='root,adm'
Error: Could not run: Parameter groups failed on User[root]: Group names must be provided as an array, not a comma-separated list.



Hey Pawel,

One way to do this from the command line would be using `puppet apply` instead of `puppet resource`, like so:

`puppet apply -e "user { 'root': groups => ['root', 'adm'] }"`
Reply all
Reply to author
Forward
0 new messages