adding oh-my-zsh for root user
This commit is contained in:
@@ -1,5 +1,15 @@
|
|||||||
|
- name: Cleanup tasks
|
||||||
|
tags: cleanup
|
||||||
|
become: true
|
||||||
|
block:
|
||||||
- name: Remove temporary directory
|
- name: Remove temporary directory
|
||||||
file:
|
file:
|
||||||
path: "{{ temp_install_dir.path }}"
|
path: "{{ temp_install_dir.path }}"
|
||||||
state: absent
|
state: absent
|
||||||
when: temp_install_dir.path is defined
|
when: temp_install_dir.path is defined
|
||||||
|
|
||||||
|
- name: Remove temporary root directory
|
||||||
|
file:
|
||||||
|
path: "{{ temp_install_dir_root.path }}"
|
||||||
|
state: absent
|
||||||
|
when: temp_install_dir_root.path is defined
|
||||||
|
|||||||
@@ -88,3 +88,71 @@
|
|||||||
group: "{{ default_user_group }}"
|
group: "{{ default_user_group }}"
|
||||||
force: yes
|
force: yes
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
|
- name: Configure shell for root user
|
||||||
|
tags: shell
|
||||||
|
become: true
|
||||||
|
block:
|
||||||
|
- name: Get root home
|
||||||
|
user:
|
||||||
|
name: root
|
||||||
|
state: present
|
||||||
|
shell: /bin/zsh
|
||||||
|
register: root_user_details
|
||||||
|
|
||||||
|
- name: Set root home
|
||||||
|
set_fact:
|
||||||
|
root_user_home: "{{ root_user_details.home }}"
|
||||||
|
|
||||||
|
- name: Print root user home
|
||||||
|
debug:
|
||||||
|
var: root_user_home
|
||||||
|
|
||||||
|
- name: Install .tmux.conf to root user
|
||||||
|
copy:
|
||||||
|
src: .tmux.conf
|
||||||
|
dest: "{{ root_user_home }}/.tmux.conf"
|
||||||
|
force: yes
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
- name: Create temporary root install directory
|
||||||
|
tempfile:
|
||||||
|
path: "{{ root_user_home }}"
|
||||||
|
state: directory
|
||||||
|
suffix: .tmp
|
||||||
|
register: temp_install_dir_root
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Download oh-my-zsh
|
||||||
|
get_url:
|
||||||
|
url: https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh
|
||||||
|
dest: "{{ temp_install_dir_root.path }}"
|
||||||
|
mode: 0777
|
||||||
|
|
||||||
|
- name: Install oh-my-zsh
|
||||||
|
shell: "sh {{ temp_install_dir_root.path }}/install.sh --unattended"
|
||||||
|
args:
|
||||||
|
creates: "{{ root_user_home }}/.oh-my-zsh"
|
||||||
|
|
||||||
|
- name: Install zsh-syntax-highlighting
|
||||||
|
git:
|
||||||
|
repo: "https://github.com/zsh-users/zsh-syntax-highlighting.git"
|
||||||
|
version: master
|
||||||
|
dest: "{{ root_user_home }}/.zsh/zsh-syntax-highlighting"
|
||||||
|
clone: yes
|
||||||
|
update: yes
|
||||||
|
|
||||||
|
- name: Install zsh-autosuggestions
|
||||||
|
git:
|
||||||
|
repo: https://github.com/zsh-users/zsh-autosuggestions
|
||||||
|
version: master
|
||||||
|
dest: "{{ root_user_home }}/.zsh/zsh-autosuggestions"
|
||||||
|
clone: yes
|
||||||
|
update: yes
|
||||||
|
|
||||||
|
- name: Install .zshrc to root user
|
||||||
|
template:
|
||||||
|
src: .zshrc.root.j2
|
||||||
|
dest: "{{ root_user_home }}/.zshrc"
|
||||||
|
force: yes
|
||||||
|
mode: 0644
|
||||||
|
|||||||
82
roles/shell/templates/.zshrc.root.j2
Normal file
82
roles/shell/templates/.zshrc.root.j2
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
# Path to your oh-my-zsh installation.
|
||||||
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
|
|
||||||
|
ZSH_THEME="agnoster"
|
||||||
|
|
||||||
|
# Which plugins would you like to load?
|
||||||
|
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
|
||||||
|
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
||||||
|
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||||
|
# Add wisely, as too many plugins slow down shell startup.
|
||||||
|
plugins=(
|
||||||
|
git
|
||||||
|
sudo
|
||||||
|
colored-man-pages
|
||||||
|
copydir
|
||||||
|
cp
|
||||||
|
jump
|
||||||
|
tmux
|
||||||
|
docker
|
||||||
|
docker-compose
|
||||||
|
)
|
||||||
|
|
||||||
|
ZSH_DISABLE_COMPFIX="true"
|
||||||
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
|
HISTSIZE=50000
|
||||||
|
SAVEHIST=10000
|
||||||
|
setopt extended_history
|
||||||
|
setopt hist_expire_dups_first
|
||||||
|
setopt hist_ignore_dups
|
||||||
|
setopt hist_ignore_space
|
||||||
|
setopt inc_append_history
|
||||||
|
setopt share_history
|
||||||
|
|
||||||
|
# Changing directories
|
||||||
|
setopt auto_cd
|
||||||
|
setopt auto_pushd
|
||||||
|
unsetopt pushd_ignore_dups
|
||||||
|
setopt pushdminus
|
||||||
|
|
||||||
|
# Completion
|
||||||
|
setopt auto_menu
|
||||||
|
setopt always_to_end
|
||||||
|
setopt complete_in_word
|
||||||
|
unsetopt flow_control
|
||||||
|
unsetopt menu_complete
|
||||||
|
zstyle ':completion:*:*:*:*:*' menu select
|
||||||
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
|
||||||
|
zstyle ':completion::complete:*' use-cache 1
|
||||||
|
zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR
|
||||||
|
zstyle ':completion:*' list-colors ''
|
||||||
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||||
|
|
||||||
|
# Other
|
||||||
|
setopt prompt_subst
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# ZSH #
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
|
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# ALIASES #
|
||||||
|
################################################################
|
||||||
|
alias ls="exa"
|
||||||
|
alias ll="exa -l"
|
||||||
|
alias pbat="bat -Pp"
|
||||||
|
alias vsource="source .venv/bin/activate"
|
||||||
|
alias size='du -c -h -d 1 | sort -h'
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# PATH #
|
||||||
|
################################################################
|
||||||
|
export PATH=/usr/sbin:$PATH
|
||||||
|
export PATH="$PATH:$HOME/.local/bin"
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# RUST #
|
||||||
|
################################################################
|
||||||
|
export PATH="{{ default_user_home }}/.cargo/bin:$PATH"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
Tasks:
|
Tasks:
|
||||||
☐ Configure nebula
|
☐ Configure nebula
|
||||||
☐ Add a simplified zsh setup with Agnoster for root user
|
✔ Add a simplified zsh setup with Agnoster for root user @done(21-03-07 23:08)
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
✔ Create initial folder layout @started(21-02-28 23:29) @done(21-03-03 14:30) @lasted(2d15h1m16s)
|
✔ Create initial folder layout @started(21-02-28 23:29) @done(21-03-03 14:30) @lasted(2d15h1m16s)
|
||||||
|
|||||||
Reference in New Issue
Block a user