Here's a bit of manifest code for a user and group. Note the explicit ordering between the resources, but also notice we're not explicitly specifying the ensure => present for either:
group {
'something':;
} -> user {
'something':
gid => 'something';
}
With the explicit ordering, I get:
> Debug: /Group[something]/before: requires User[something]
And without it, I get:
> Debug: /User[something]: Autorequiring Group[something]
So, the ordering at least seems to be noticed. But, regardless (in both cases), puppet attempts to add the user first, without attempting to add the group:
> Debug: /User[something]: Autorequiring Group[something]
> Info: Applying configuration version '1383263341'
> Debug: Executing '/usr/sbin/useradd -g something something'
> Error: Could not create user something: Execution of '/usr/sbin/useradd -g something something' returned 6: useradd: group 'something' does not exist
> Error: /User[something]/ensure: change from absent to present failed: Could not create user something: Execution of '/usr/sbin/useradd -g something something' returned 6: useradd: group 'something' does not exist
The manifest code above is the only thing in the file, and I'm using `puppet apply` to run it to really get it down to a minimal test case.
This seems to be because a group resource without an explicit ensure => 'present' will never be created. However, a user resource without an explicit ensure will. This seems weirdly inconsistent, and there's no mention of the distinction that I could see in the Type Reference documentation. Is it an expected difference between the types? Or just a matter of undefined behaviour when ensure isn't given to resources (some ensure present, some do nothing)?
Regards,
Dominic