Browse Source

shell setup

master
parent
commit
4e93be995d
8 changed files with 34 additions and 46 deletions
  1. +1
    -0
      defaults/main.yaml
  2. +0
    -0
      files/shells/fish/global/fish_greeting.fish
  3. +5
    -5
      files/shells/fish/global/fish_prompt.fish
  4. +0
    -0
      files/shells/fish/global/fish_title.fish
  5. +0
    -0
      files/shells/fish/root/root-shell-aliases.fish
  6. +13
    -0
      files/shells/xonsh/xonshrc
  7. +0
    -40
      tasks/fish.yaml
  8. +15
    -1
      tasks/main.yaml

+ 1
- 0
defaults/main.yaml View File

@@ -8,6 +8,7 @@ locales_gen:
- de_DE.UTF-8 - de_DE.UTF-8


root_ssh_key: false root_ssh_key: false
root_shell: /usr/bin/xonsh


debian_distribution: bullseye debian_distribution: bullseye
debian_components: debian_components:


files/fish/global/fish_greeting.fish → files/shells/fish/global/fish_greeting.fish View File


files/fish/global/fish_prompt.fish → files/shells/fish/global/fish_prompt.fish View File

@@ -5,23 +5,23 @@ function fish_prompt --description 'prompt'
set -g __fish_prompt_hostname (hostname|cut -d . -f 1) set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
end end


set -l color_cwd
set -l color_prompt
set -l suffix set -l suffix
switch $USER switch $USER
case root toor case root toor
if set -q fish_color_cwd_root if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
set color_prompt $fish_color_cwd_root
else else
set color_cwd $fish_color_cwd
set color_prompt $fish_color_cwd
end end
set suffix '#' set suffix '#'
case '*' case '*'
echo -n -s "$USER" @ echo -n -s "$USER" @
set color_cwd $fish_color_cwd
set color_prompt $fish_color_cwd
set suffix '>' set suffix '>'
end end


set -g fish_prompt_pwd_dir_length 0 set -g fish_prompt_pwd_dir_length 0


echo -n -s "$__fish_prompt_hostname" : (set_color $color_cwd) (prompt_pwd) (set_color normal) " $suffix "
echo -n -s "$__fish_prompt_hostname" : (prompt_pwd) (set_color normal) " " (set_color $color_prompt) "$suffix "
end end

files/fish/global/fish_title.fish → files/shells/fish/global/fish_title.fish View File


files/fish/root/root-shell-aliases.fish → files/shells/fish/root/root-shell-aliases.fish View File


+ 13
- 0
files/shells/xonsh/xonshrc View File

@@ -0,0 +1,13 @@
xontrib load abbrevs coreutils
$MULTILINE_PROMPT=''
$PROMPT = lambda: '{user}@{hostname}:{cwd} {gitstatus: [{}]}{prompt_end} '
$PROMPT_FIELDS['prompt_end'] = lambda: '{INTENSE_RED}@#' if $USER == "root" else '{GREEN}@'
def prompt():
p = ''
if $USER != "root" or $USER != "toor":
p = '{INTENSE_GREEN}{user}{WHITE}@{INTENSE_CYAN}{hostname}'
else:
p = '{INTENSE_RED}{hostname}'
p += '{WHITE}:{INTENSE_YELLOW}{cwd} {DEFAULT}{gitstatus: [{}]}{prompt_end} '
return p
$PROMPT = prompt

+ 0
- 40
tasks/fish.yaml View File

@@ -1,40 +0,0 @@
---

- name: fish package
apt:
pkg: fish

- name: fish config directory
file:
path: /etc/fish/conf.d
state: directory

- name: fish config files
copy:
src: fish/global/
dest: /etc/fish/conf.d/
with_items:
- fish_title
- fish_prompt
- fish_greeting

- name: fish package
package:
name: fish
when: not root_target_directory is defined

# root user
- name: fish root user config directory
file:
path: /root/.config/fish/conf.d/
state: directory

- name: fish root user config files
copy:
src: fish/root/
dest: /root/.config/fish/conf.d/

- name: fish shell for root user
user:
name: root
shell: /usr/bin/fish

+ 15
- 1
tasks/main.yaml View File

@@ -2,7 +2,6 @@


# user setup # user setup
- import_tasks: root_user.yaml - import_tasks: root_user.yaml
- import_tasks: fish.yaml
- import_tasks: ssh-agent.yaml - import_tasks: ssh-agent.yaml


# system setup # system setup
@@ -29,3 +28,18 @@


- import_tasks: debian_packages.yaml - import_tasks: debian_packages.yaml
when: ansible_distribution == "Debian" when: ansible_distribution == "Debian"
# shell setup
- import_tasks: shells/fish.yaml
tags:
- fish
- shells
- import_tasks: shells/xonsh.yaml
tags:
- xonsh
- shells
- name: shell for root user
user:
name: root
shell: "{{root_shell}}"
tags:
- shells