I'd like to set the default shell to zsh in Puppet. Preferably for the current user because I just run my modules as puppet apply mymodule.pp
since I store my configuration that I use across multiple machines in git.
How can I set the default shell using puppet?
If you want to set the shell of an existing user, simply do:
If you want to set the shell of whatever user Puppet is happening to run as, you can make use of the
$id
fact which returns the name of the current user. This feels a little bit magical to me, and may result in undesired outcomes, like if you're running as thepuppet
user with apuppet agent
run and you end up setting a shell for a user that shouldn't have interactive logins.That would be done like:
Note: the "ensure => present" is optional.
You can specify user shell when you realize the user, which should be created as a virtual resource. See or search for puppet best practices to get details.