diff --git a/defaults/main.yml b/defaults/main.yml index 1dc55a4..5bebe4b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/tasks/main.yml b/tasks/main.yml index 4c78f1b..c16acad 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 diff --git a/templates/bashrc.j2 b/templates/bashrc.j2 deleted file mode 100644 index df3b035..0000000 --- a/templates/bashrc.j2 +++ /dev/null @@ -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" diff --git a/templates/root-shell-aliases.fish.j2 b/templates/root-shell-aliases.fish.j2 new file mode 100644 index 0000000..6c99ee1 --- /dev/null +++ b/templates/root-shell-aliases.fish.j2 @@ -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 %}