manala.ohmyzsh
#######################################################################################################
:exclamation: DEPRECATED :exclamation:
This repository and its role are no longer supported. Please use the Manala Ansible Collection instead.
For usage information, visit the collection repository.
#######################################################################################################
Ansible Role: Oh My Zsh 
:exclamation: Please report issues and submit Pull Requests at the main Ansible Role repository :exclamation:
This role is for setting up Oh My Zsh.
It is part of the Manala Ansible stack but can also be used alone.
Requirements
None.
Dependencies
None.
Installation
Ansible 2+
Use the ansible galaxy command line:
ansible-galaxy install manala.ohmyzsh
Or use an ansible galaxy requirements file:
- src: manala.ohmyzsh
Role Handlers
None
Role Variables
Name | Default | Type | Description |
---|---|---|---|
manala_ohmyzsh_dir |
'/usr/local/share/oh-my-zsh' | String | Directory for Oh My Zsh installation |
manala_ohmyzsh_users_defaults |
[] | Array | Default configurations for users |
manala_ohmyzsh_users |
[] | Array | List of users with their own Oh My Zsh configurations |
manala_ohmyzsh.update |
false | Boolean | Auto-update to the latest version of Oh My Zsh |
manala_ohmyzsh_custom_themes_exclusive |
false | Boolean | Remove existing custom themes |
manala_ohmyzsh_custom_themes_dir |
'/etc/supervisor/conf.d' | String | Directory for custom themes |
manala_ohmyzsh_custom_themes_defaults |
{} | Array | Default configurations for custom themes |
manala_ohmyzsh_custom_themes |
[] | Array | List of custom themes |
Oh My Zsh Configuration
Use manala_ohmyzsh_users_defaults
to set default configuration templates for different users.
manala_ohmyzsh_users_defaults:
template: my/.zshrc.j2
Use manala_ohmyzsh_dir
to specify where to install Oh My Zsh.
manala_ohmyzsh_dir: /usr/local/share/oh-my-zsh
User Configuration
With manala_ohmyzsh_users
, you can set up each user account like this:
Name | Default | Type | Description |
---|---|---|---|
user |
~ (required) | String | Name of the user account |
home |
'root' or '~' ~ item.user | String | User account home directory |
template |
~ | String | Template for Oh My Zsh configuration |
config |
~ | Array/String | List of Oh My Zsh options |
state |
'present' | String | State |
manala_ohmyzsh_users:
- user: root
template: users/manala/.zshrc.j2
config:
ZSH_THEME: default.prod
plugins: [git, debian, common-aliases, history, history-substring-search]
- user: root
group: foo # Defaults to the user's primary group, can be changed
config:
ZSH_THEME: default.prod
plugins: [git, debian, common-aliases, history, history-substring-search]
- user: root
config: |
# Path to your Oh My Zsh installation.
export ZSH=$HOME/.oh-my-zsh
- user: root
config:
- ZSH_THEME: default.prod
- plugins: (git debian common-aliases history history-substring-search)
- user: bar
state: ignore # This entry will be ignored
- "{{ my_custom_users_array }}"
Custom Themes
Set manala_ohmyzsh_custom_themes_exclusive
to clean up existing custom themes in the directory specified by manala_ohmyzsh_custom_themes_dir
. This ensures no old or manually created files interfere with the current configuration.
manala_ohmyzsh_custom_themes_exclusive: true
manala_ohmyzsh_custom_themes:
- file: foo.zsh-theme
config: |
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
- template: ohmyzsh/custom/template.zsh-theme.j2 # Template based (file name based on template)
- file: bar.zsh-theme
template: ohmyzsh/custom/template.zsh-theme.j2 # Template based with forced file name
- file: absent.zsh-theme
state: absent # "present" by default
- file: ignore.zsh-theme
state: ignore # This configuration will be ignored
- "{{ my_custom_themes_array }}"
Note: By default, this role will install these custom theme templates for backward compatibility:
- custom/themes/default.dev.j2
- custom/themes/default.demo.j2
- custom/themes/default.staging.j2
- custom/themes/default.prod.j2
Flags
Allow Oh My Zsh to check for new updates from the repository:
manala_ohmyzsh:
update: true
# This can also be set for all manala roles
manala:
update: true
Example Playbook
- hosts: servers
roles:
- role: manala.ohmyzsh
License
MIT
Author Information
Manala (http://www.manala.io/)
ansible-galaxy install manala.ohmyzsh