Browse Source

use fish as default shell

master
Markus Katharina Brechtel 6 years ago
parent
commit
9c6bce04cb
4 changed files with 48 additions and 15 deletions
  1. +5
    -1
      defaults/main.yml
  2. +36
    -3
      tasks/main.yml
  3. +0
    -11
      templates/bashrc.j2
  4. +7
    -0
      templates/root-shell-aliases.fish.j2

+ 5
- 1
defaults/main.yml View File

@@ -1,5 +1,9 @@
root_user_aliases:
root_ssh_key: false

root_shell_aliases:
- name: aptitude-list-manually-installed
description: list all manually installed packages without system packages
command: aptitude search '!?priority(required) !?priority(important) ?installed !?automatic'
- name: apt-tail-log
description: tail the apt log
command: tail -f /var/log/apt/term.log

+ 36
- 3
tasks/main.yml View File

@@ -1,6 +1,39 @@
---

- name: root bashrc
- name: fish package
package:
name: fish

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

- name: fish config files
template:
src: bashrc.j2
dest: /root/.bashrc
src: "{{ item }}.fish.j2"
dest: /root/.config/fish/conf.d/{{ item }}.fish
with_items:
- root-shell-aliases

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

- name: ssh key
user:
name: root
generate_ssh_key: yes
ssh_key_type: ed25519
when: root_ssh_key

- name: password
user:
name: root
password: "{{ root_password }}"
when: root_password is defined

- file:
path: /root/.config/fish/conf.d/title.fish
state: absent

+ 0
- 11
templates/bashrc.j2 View File

@@ -1,11 +0,0 @@
# ~/.bashrc: executed by bash(1) for non-login shells.

{{ ansible_managed | comment }}

{% for alias in root_user_aliases %}
alias {{alias.name}}="{{alias.command}}"
{% endfor %}

HISTFILE=/root/.history
shopt -s histappend # append to history, don't overwrite it
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

+ 7
- 0
templates/root-shell-aliases.fish.j2 View File

@@ -0,0 +1,7 @@
{{ ansible_managed | comment }}

{% for alias in root_shell_aliases %}
function {{ alias.name }} --description {{ alias.description | quote }}
{{alias.command}} $argv
end
{% endfor %}