Last active
March 25, 2024 19:36
-
-
Save bschonec/c2800816d720fb2ef7064eeffcf308eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
mongodb::users: | |
mongo: | |
ensure: present | |
purge_sshkeys: true | |
managehome: true | |
expiry: absent | |
password_max_age: -1 | |
uid: 1001 | |
group: dba | |
groups: | |
- wheel | |
membership: minimum | |
before: | |
- Class[ivanti] | |
require: | |
- Group[dba] | |
include ivanti | |
# Just in case the groups in hiera have "before:" set, we want to merge those | |
# settings with the 'before: Class[ivanti]' here. | |
# The following files have ./bin and ./etc | |
$hiera_defaults = { before => Class['ivanti'], } | |
$mgdbgrps = lookup('mongodb::groups', Optional[Hash], { strategy => 'deep' }, {}) | |
$mgdbgrps.each | $mgdbgrp, $mgdbgrp_attributes | { | |
$attributes = deep_merge($hiera_defaults, $mgdbgrp_attributes) | |
notify {"XXXX Creating group ${mgdbgrp} with original attributes ${mgdbgrp_attributes} merged to ${attributes}.":} | |
group { $mgdbgrp: | |
* => $attributes, | |
} | |
} | |
# # Create and configure users. Again, we must create the user accounts before | |
# # Ivanti is installed because Ivanti will step on our UID/GID 1001 when it creates | |
# # the landesk user. | |
$mgdbusers = lookup('mongodb::users', Optional[Hash], { strategy => 'deep' }, {}) | |
$mgdbusers.each | $mgdbuser, $mgdbuser_attributes | { | |
$attributes = deep_merge($hiera_defaults, $mgdbuser_attributes) | |
#notify {"XXXX Creating account ${mgdbuser} with attributes ${attributes}.":} | |
accounts::user { | |
$mgdbuser: * => $attributes, | |
ignore_password_if_empty => true, | |
password => '', # Don't change password. | |
bashrc_content => file('accounts/shell/bashrc'), | |
bash_profile_content => file('accounts/shell/bash_profile'), | |
} | |
} | |
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Invalid relationship: Accounts::User[mongo] { before => Class[ivanti] }, because Class[ivanti] doesn't seem to be in the catalog | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment