-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependency cycle when creating group and user #39
Comments
Not sure what you're trying to do. This configuration should throw an error, because you're defining two groups with same
If you want a group with several member you can do this class {'accounts':
groups => {
'testgroup' => {
'gid' => 800,
'members' => [ 'www-data', 'testuser']
}
},
users => { 'testuser' => {
'shell' => '/bin/bash',
}}
} or class {'accounts':
groups => {
'testgroup' => {
'gid' => 800,
'members' => [ 'www-data']
}
},
users => { 'testuser' => {
'shell' => '/bin/bash',
'groups' => [ 'testgroup']
}}
} These configurations should be equivalent. |
Your examples are working and are equivalent and to be specific - they produce this:
I can't figure out how to be exactly this ``testuser:x:10003:800:....` |
What about? class {'accounts':
groups => {
'testgroup' => {
'gid' => 800,
'members' => [ 'www-data', 'testuser' ]
}
},
users => { 'testuser' => {
'shell' => '/bin/bash',
'primary_group' => 'testgroup'
}}
} |
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Group[testgroup] is already declared; cannot redeclare |
Yeah, that's a problem 😟 The 1.3.x release went through quite significant refactoring. It's still a bit experimental release. We're able to add/remove members to groups, but primary groups are a bit tricky. |
- avoid redeclaration of primary group - manage all group membership
I've managed to get rid of the dependency cycle (in dev branch). Right now the GID is setted up yet, it's just a proof-of-concept:
|
Got the same error as @dimov-cz on 1.2.1. accounts::groups:
myname:
ensure: present
accounts::users:
myname:
comment: "myname myname2"
ssh_key:
type: "ssh-rsa"
key: "AAAAB3NzaC1yc2EAAAADAQABAAABAQC+g9RlVRmA84VPH8+UIszzH6eyRftEBk6cs0YbHRIY9amcWtv41ziCu1shFLRyYdcHpVo0YIrJj+lstpqNVE1PSISc8xYpksKkT81PWH/41YtxXn2VFtNgXGx20ziMXtHQatrs3UlcUaW"
comment: "myname@domain"
groups: ['sudo', 'myname']
shell: '/bin/bash' Works if I use a different group name different to the user. |
Merged into master, feel free to test it.
Following code works (tested on Debian 7 and CentOS 6 image): class {'accounts':
groups => {
'testgroup' => {
'gid' => 800,
'members' => ['www-data', 'testuser']
}
},
users => {
'testuser' => {
'shell' => '/bin/bash',
'primary_group' => 'testgroup'
},
'www-data' => {
'manage_group' => false,
'home' => '/var/www'
}
}
} It creates user account:
The problem is, that we create a
but at the same time users are assigned:
although the command returns |
Just tested and tried to create a group with the same name as a user. It didn't work returning duplicated declaration. Is it something that should be fixed with this new changes? |
@deric same error.
Here my config: #Debian default settings
#basic groups and accounts for debian
accounts:
user_defaults:
authorized_keys_file: '/etc/ssh/%u/authorized_keys'
manage_group: false
shell: "/bin/bash"
accounts::groups:
it:
ensure: present
accounts::users:
it:
comment: "IT Admin"
managehome: true
pwhash: '$1$dn3lUNjy$i00w1UuAzN7M/yNtGX0a9/'
groups: ['sudo', 'it']
jordi:
comment: "Jordi Garcia"
groups: ['sudo', 'it']
shell: '/bin/zsh' Works when using as group name |
Maybe I should open another issue but I noticed that group members are randomly ordered every time puppet runs. |
A workaround seems to be setting accounts::groups:
it:
ensure: present
accounts::users:
it:
comment: "IT Admin"
managehome: true
primary_group: 'it'
pwhash: '$1$dn3lUNjy$i00w1UuAzN7M/yNtGX0a9/'
groups: ['sudo'] Here's an example that works for me:
|
Didn't know |
- primary groups are not created via puppet User resource - first create users, then groups and add members into groups
Should be fixed in v1.5.0, please open new issue if you run into any problems. |
I just updated from 1.2 to 1.3.2, one problem disappered for me but one new comes.
I tried another options with primary_group etc. without success. Is there another way or workaround how to create group with exact gid and another user in it?
The text was updated successfully, but these errors were encountered: