Configure zsh for your system and users. Uses oh-my-zsh for theme and plugin configuration, if set.
You must create the user on the system before using this cookbook. User management and identification is done based on fnichol/chef-user and it is highly recommended.
# set a list of users you wish to modify
['users'] = [ ]
# list of urls of extra themes to add
['oh-my-zsh']['themes'] = [ ]
# hashmap of extra plugin names and urls to add
['oh-my-zsh']['plugins'] = { }
Just include chef-zsh
in your node's run_list
. Configure your users in users
attribute.
{
"users": [ "test" ],
"run_list": [
"recipe[user]",
"recipe[zsh]"
]
}
Add users to your data_bags
. Example test user (data_bags/users/test.json
):
{
"id" : "test",
"gid" : "users",
"home" : "/home/test",
"shell" : "/usr/bin/zsh",
"zsh_theme" : "zero-dark",
"zsh_plugins" : "git extract zero web-search",
"zsh_aliases" : {
"gll": "git log --color --all"
}
}
A fully customized example:
{
"users": [
"test"
],
"oh-my-zsh": {
"themes": [
"https://raw.github.com/arlimus/zero.zsh/master/themes/zero.zsh-theme.base",
"https://raw.github.com/arlimus/zero.zsh/master/themes/zero-dark.zsh-theme",
"https://raw.github.com/arlimus/zero.zsh/master/themes/zero-light.zsh-theme"
],
"plugins": {
"zero": "https://raw.github.com/arlimus/zero.zsh/master/plugins/zero/zero.plugin.zsh"
}
},
"run_list": [
"recipe[user]",
"recipe[zsh]"
]
}
As for the root user, it's only slightly different. You create a data_bags/users/root.json
as you would for every other user.
{
"id" : "root",
"shell" : "/usr/bin/zsh",
"zsh_theme" : "zero-dark",
"zsh_plugins" : "git extract zero web-search",
}
However, you don't add root
to your users
array in the attributes:
{
"users": [ "alice", "bob", "unkle" ],
"run_list": [
"recipe[user]",
"recipe[zsh]"
]
}
The root
user is the one exception, where the json in your data_bags
is getting interpreted as soon as it is created, without the user being in the users
list. (This is necessary to get along with the chef-user
cookbook, while still being able to configure root.)
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write you change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
Authors: Dominik Richter dominik.richter@googlemail.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.