first commit
This commit is contained in:
54
roles/fish/tasks/main.yml
Normal file
54
roles/fish/tasks/main.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
---
|
||||
|
||||
- debug:
|
||||
msg: "basic_{{ ansible_facts['distribution']| lower | replace( ' ', '-') }}.yml"
|
||||
|
||||
- name: Load system-specific parameters
|
||||
include_vars: >
|
||||
basic_{{ ansible_facts['distribution']| lower | replace( ' ', '-') }}.yml
|
||||
|
||||
- name: Update pacman mirrorlist on Archlinux
|
||||
command: pacman -Syy
|
||||
when: ansible_facts['distribution'] == "Archlinux"
|
||||
|
||||
- name: Install Packages
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop:
|
||||
- "{{ basic_packages }}"
|
||||
|
||||
- name: Gather user information
|
||||
ansible.builtin.getent:
|
||||
database: passwd
|
||||
|
||||
# - name: Get all users with bash or zsh shell
|
||||
# ansible.builtin.shell: |
|
||||
# awk -F: '$7 ~ /bash|zsh/ {print $1}' /etc/passwd
|
||||
# register: users_with_bash_zsh
|
||||
#
|
||||
# - name: Set Fish as default shell for each user
|
||||
# ansible.builtin.user:
|
||||
# name: "{{ item }}"
|
||||
# shell: "{{ fish_shell_path }}"
|
||||
# loop: "{{ users_with_bash_zsh.stdout_lines }}"
|
||||
|
||||
- name: Create a list of users with bash or zsh shell
|
||||
set_fact:
|
||||
my_users: "{{ ansible_facts.getent_passwd | dict2items | selectattr('value.5', 'in', ['/bin/bash', '/usr/bin/bash', '/bin/zsh', '/usr/bin/zsh']) | map(attribute='key') | list }}"
|
||||
|
||||
- name: Debug my_users
|
||||
debug:
|
||||
var: my_users
|
||||
|
||||
- name: Set Fish as default shell for each user
|
||||
ansible.builtin.user:
|
||||
name: "{{ item }}"
|
||||
shell: "{{ fish_shell_path }}"
|
||||
loop: "{{ my_users }}"
|
||||
|
||||
- name: Kopier Config File
|
||||
ansible.builtin.template:
|
||||
src: config.fish.j2
|
||||
dest: /etc/fish/config.fish
|
||||
|
||||
86
roles/fish/templates/config.fish.j2
Executable file
86
roles/fish/templates/config.fish.j2
Executable file
@@ -0,0 +1,86 @@
|
||||
#kleine fish - Welcome - Nachricht
|
||||
set -U fish_greeting "Hallo du kleiner Fish"
|
||||
setenv SSH_ENV $HOME/.ssh/environment
|
||||
|
||||
function start_agent
|
||||
echo "Initializing new SSH agent ..."
|
||||
ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV
|
||||
echo "succeeded"
|
||||
chmod 600 $SSH_ENV
|
||||
. $SSH_ENV > /dev/null
|
||||
ssh-add
|
||||
end
|
||||
|
||||
function test_identities
|
||||
ssh-add -l | grep "The agent has no identities" > /dev/null
|
||||
if [ $status -eq 0 ]
|
||||
ssh-add
|
||||
if [ $status -eq 2 ]
|
||||
start_agent
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if [ -n "$SSH_AGENT_PID" ]
|
||||
ps -ef | grep $SSH_AGENT_PID | grep ssh-agent > /dev/null
|
||||
if [ $status -eq 0 ]
|
||||
test_identities
|
||||
end
|
||||
else
|
||||
if [ -f $SSH_ENV ]
|
||||
. $SSH_ENV > /dev/null
|
||||
end
|
||||
ps -ef | grep $SSH_AGENT_PID | grep -v grep | grep ssh-agent > /dev/null
|
||||
if [ $status -eq 0 ]
|
||||
test_identities
|
||||
else
|
||||
start_agent
|
||||
end
|
||||
end
|
||||
# Einstell u ng e n nur f ü r die interakti v e Nutzung
|
||||
if status is-interactive
|
||||
# abr statt alias
|
||||
#
|
||||
#
|
||||
# alias zshconfig="vim ~/.zshrc"
|
||||
|
||||
{% if ansible_facts['os_family'] == "Debian" %}
|
||||
abbr cat "/usr/bin/batcat"
|
||||
{%else %}
|
||||
abbr cat "bat"
|
||||
{% endif %}
|
||||
|
||||
abbr ll "eza -loi --git --git-repos --header --hyperlink -X -s size"
|
||||
abbr vim "nvim"
|
||||
abbr activate_poetry 'eval $(poetry env activate)'
|
||||
export CDPATH="/home/$USER/:/home/$USER/Projekte"
|
||||
abbr -a gc 'git commit '
|
||||
# Liebling seditor
|
||||
set -gx EDITOR /usr/bin/nvim
|
||||
#/home/jonnybravo/Projekte/Python_Skripte/SSH_Agent/main.py
|
||||
fastfetch # -c /home/jonnybravo/.config/fastfetch/my_config.jsonc
|
||||
if type -q tmux
|
||||
if not test -n "$TMUX"
|
||||
tmux attach-session -t default; or tmux new-session -s default
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if [ -n "$SSH_AGENT_PID" ]
|
||||
ps -ef | grep $SSH_AGENT_PID | grep ssh-agent > /dev/null
|
||||
if [ $status -eq 0 ]
|
||||
test_identities
|
||||
end
|
||||
else
|
||||
if [ -f $SSH_ENV ]
|
||||
. $SSH_ENV > /dev/null
|
||||
end
|
||||
ps -ef | grep $SSH_AGENT_PID | grep -v grep | grep ssh-agent > /dev/null
|
||||
if [ $status -eq 0 ]
|
||||
test_identities
|
||||
else
|
||||
start_agent
|
||||
end
|
||||
end
|
||||
end
|
||||
9
roles/fish/vars/basic_archlinux.yml
Executable file
9
roles/fish/vars/basic_archlinux.yml
Executable file
@@ -0,0 +1,9 @@
|
||||
basic_packages:
|
||||
- "vim"
|
||||
- "fish"
|
||||
- "bat"
|
||||
- "eza"
|
||||
- "neovim"
|
||||
- "fastfetch"
|
||||
fish_shell_path: "/usr/bin/fish"
|
||||
|
||||
9
roles/fish/vars/basic_debian.yml
Executable file
9
roles/fish/vars/basic_debian.yml
Executable file
@@ -0,0 +1,9 @@
|
||||
basic_packages:
|
||||
- "vim"
|
||||
- "fish"
|
||||
- "bat"
|
||||
- "eza"
|
||||
- "neovim"
|
||||
- "fastfetch"
|
||||
fish_shell_path: "/usr/bin/fish"
|
||||
|
||||
8
roles/fish/vars/basic_ubuntu.yml
Executable file
8
roles/fish/vars/basic_ubuntu.yml
Executable file
@@ -0,0 +1,8 @@
|
||||
basic_packages:
|
||||
- "vim"
|
||||
- "fish"
|
||||
- "bat"
|
||||
- "eza"
|
||||
- "neovim"
|
||||
fish_shell_path: "/usr/bin/fish"
|
||||
|
||||
Reference in New Issue
Block a user