Skip to content
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

added forcelocal option #90

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

added forcelocal option #90

wants to merge 3 commits into from

Conversation

hanej
Copy link

@hanej hanej commented Oct 26, 2017

Adding the forcelocal option so the OS doesn't try to update LDAP when making user or group changes. The resource collector was added to the init.pp manifest so when creating local accounts, the group is created first.

@hanej
Copy link
Author

hanej commented Oct 26, 2017

Darn. I see the circular dependency. The use case I'm trying to solve is when there is a group in LDAP and you're trying to create that same group locally. Without the forcelocal option applied, the user gets created, knows the group exists in LDAP, and stops. Then the group class kicks in, sees the group isn't local and tries to do a groupmod which fails.

Using forcelocal fixes that problem but when using manage_group: false for the user, the group has to be created first otherwise the user creation fails.

@hanej
Copy link
Author

hanej commented Oct 27, 2017

I'm stuck. This works for my use case where I'm trying to create a local version of a single LDAP group. I see in gpasswd it's trying to create the group and add the user in one shot however at this point the user doesn't exist. When the user does get created it gets added to the correct group.

Warning: Modifying bolt => Execution of '/usr/bin/gpasswd -a bolt bolt' returned 3: gpasswd: user 'bolt' does not exist
Notice: /Stage[main]/Accounts/Accounts::Group[bolt]/Group[bolt]/ensure: created
Notice: /Stage[main]/Accounts/Accounts::User[bolt]/User[bolt]/ensure: created

Here's my hiera

accounts::groups:
  bolt:
    gid: 10572
    forcelocal: true

accounts::users:
  bolt:
    home: '/home/bolt'
    uid: 10572
    purge_ssh_keys: true
    manage_ssh_dir: true
    forcelocal: true
    manage_group: false
    groups:
      - 'bolt'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant