Markus Katharina Brechtel преди 2 години
родител
ревизия
4e93be995d
променени са 8 файла, в които са добавени 34 реда и са изтрити 46 реда
  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 Целия файл

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

root_ssh_key: false
root_shell: /usr/bin/xonsh

debian_distribution: bullseye
debian_components:


files/fish/global/fish_greeting.fish → files/shells/fish/global/fish_greeting.fish Целия файл


files/fish/global/fish_prompt.fish → files/shells/fish/global/fish_prompt.fish Целия файл

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

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

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

files/fish/global/fish_title.fish → files/shells/fish/global/fish_title.fish Целия файл


files/fish/root/root-shell-aliases.fish → files/shells/fish/root/root-shell-aliases.fish Целия файл


+ 13
- 0
files/shells/xonsh/xonshrc Целия файл

@@ -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 Целия файл

@@ -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 Целия файл

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

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

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

- import_tasks: debian_packages.yaml
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