summaryrefslogtreecommitdiff
path: root/roles/zsh
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-12-26 23:25:02 +0100
committerChristian Pointner <equinox@spreadspace.org>2019-12-26 23:25:02 +0100
commit74684fb93e26e2c9f37f699a84eb94acaf93c07a (patch)
treeb514b605b934a6ee074a200e75f918ba05ad109e /roles/zsh
parentnextcloud: upgrade all instances and add occ script (diff)
parentbase role supports openbsd now too (diff)
Merge branch 'topic/openbsd-test'
Diffstat (limited to 'roles/zsh')
-rw-r--r--roles/zsh/tasks/main.yml37
-rw-r--r--roles/zsh/templates/banner.chaos-at-home.j22
-rw-r--r--roles/zsh/templates/banner.elevate.j22
-rw-r--r--roles/zsh/templates/banner.skillz.j22
-rw-r--r--roles/zsh/templates/banner.spreadspace.j22
-rw-r--r--roles/zsh/vars/Debian.yml12
-rw-r--r--roles/zsh/vars/OpenBSD.yml12
7 files changed, 50 insertions, 19 deletions
diff --git a/roles/zsh/tasks/main.yml b/roles/zsh/tasks/main.yml
index 80880f83..a5ae60ec 100644
--- a/roles/zsh/tasks/main.yml
+++ b/roles/zsh/tasks/main.yml
@@ -1,13 +1,21 @@
---
-- name: install zsh packages
- apt:
+- name: load os/distrubtion/version specific variables
+ include_vars: "{{ item }}"
+ with_first_found:
+ - files:
+ - "{{ ansible_distribution_release }}.yml"
+ - "{{ ansible_distribution }}.yml"
+ - "{{ ansible_os_family }}.yml"
+
+- name: install zsh package
+ package:
name: zsh
state: present
- name: install zsh-config
loop:
- src: "zshrc"
- dest: "/etc/zsh/zshrc"
+ dest: "{{ zsh_conf_base_dir }}/zshrc"
- src: "zshrc.skel"
dest: "/etc/skel/.zshrc"
loop_control:
@@ -20,19 +28,17 @@
loop: "{{ [ 'root' ] | union(zsh_loginshell_user | default([])) }}"
user:
name: "{{ item }}"
- shell: /bin/zsh
-
-- name: make zsh the default shell for useradd
- lineinfile:
- regexp: '^#?SHELL='
- line: 'SHELL=/bin/zsh'
- path: /etc/default/useradd
+ shell: "{{ zsh_bin_path }}"
-- name: make zsh the default shell for adduser
+- name: make zsh the default shell for new users
+ loop: "{{ zsh_default_shell_lineinfile | dict2items }}"
+ loop_control:
+ label: "{{ item.key }} ('{{ item.value.regexp }}' -> '{{ item.value.line }}')"
lineinfile:
- regexp: '^#?DSHELL='
- line: 'DSHELL=/bin/zsh'
- path: /etc/adduser.conf
+ path: "{{ item.key }}"
+ regexp: "{{ item.value.regexp }}"
+ line: "{{ item.value.line }}"
+ create: yes
- name: install shell banner
when: zsh_banner is defined
@@ -46,6 +52,7 @@
- name: enable banner for zsh login
lineinfile:
- path: /etc/zsh/zlogin
+ path: "{{ zsh_conf_base_dir }}/zlogin"
line: /etc/banner.sh
insertbefore: "^## END OF FILE #"
+ create: yes
diff --git a/roles/zsh/templates/banner.chaos-at-home.j2 b/roles/zsh/templates/banner.chaos-at-home.j2
index 74762bbe..c0e71647 100644
--- a/roles/zsh/templates/banner.chaos-at-home.j2
+++ b/roles/zsh/templates/banner.chaos-at-home.j2
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!{{ zsh_banner_shell }}
echo -e ""
echo -e " \033[0;37m █████╗██╗ ██╗ ████╗ █████╗ ██████╗\033[1;30m ██████╗ \033[0;37m██╗ ██╗ █████╗ ███╗ ███╗█████╗\033[0m"
diff --git a/roles/zsh/templates/banner.elevate.j2 b/roles/zsh/templates/banner.elevate.j2
index d2c9b907..03dfa73b 100644
--- a/roles/zsh/templates/banner.elevate.j2
+++ b/roles/zsh/templates/banner.elevate.j2
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!{{ zsh_banner_shell }}
echo -e ""
echo -e " \033[1;37m██████████ ██ ██████████ ▜█▙ ▟█▛ ▟██▙ ██████████ ██████████\033[0m"
diff --git a/roles/zsh/templates/banner.skillz.j2 b/roles/zsh/templates/banner.skillz.j2
index 8492c918..4c883d22 100644
--- a/roles/zsh/templates/banner.skillz.j2
+++ b/roles/zsh/templates/banner.skillz.j2
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!{{ zsh_banner_shell }}
echo -e ""
echo -e " \033[1;35m███████╗██╗ ██╗██╗██╗ ██╗ ███████╗\033[0;35m ██████╗ ██╗███████╗\033[0m"
diff --git a/roles/zsh/templates/banner.spreadspace.j2 b/roles/zsh/templates/banner.spreadspace.j2
index ec59509f..c592804e 100644
--- a/roles/zsh/templates/banner.spreadspace.j2
+++ b/roles/zsh/templates/banner.spreadspace.j2
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!{{ zsh_banner_shell }}
echo -e ""
echo -e " \033[0;33m█████╗█████╗ █████╗ █████╗ ████╗ █████╗ █████╗█████╗ ████╗ ████╗█████╗\033[0m"
diff --git a/roles/zsh/vars/Debian.yml b/roles/zsh/vars/Debian.yml
new file mode 100644
index 00000000..7138fd2f
--- /dev/null
+++ b/roles/zsh/vars/Debian.yml
@@ -0,0 +1,12 @@
+---
+zsh_banner_shell: /bin/bash
+zsh_bin_path: /bin/zsh
+zsh_conf_base_dir: /etc/zsh
+
+zsh_default_shell_lineinfile:
+ /etc/default/useradd:
+ regexp: '^#?SHELL='
+ line: 'SHELL=/bin/zsh'
+ /etc/adduser.conf:
+ regexp: '^#?DSHELL='
+ line: 'DSHELL=/bin/zsh'
diff --git a/roles/zsh/vars/OpenBSD.yml b/roles/zsh/vars/OpenBSD.yml
new file mode 100644
index 00000000..d11fe11e
--- /dev/null
+++ b/roles/zsh/vars/OpenBSD.yml
@@ -0,0 +1,12 @@
+---
+zsh_banner_shell: /bin/ksh
+zsh_bin_path: /usr/local/bin/zsh
+zsh_conf_base_dir: /etc
+
+zsh_default_shell_lineinfile:
+ /etc/usermgmt.conf:
+ regexp: '^#?shell\s'
+ line: 'shell /usr/local/bin/zsh'
+ /etc/adduser.conf:
+ regexp: '^#?defaultshell='
+ line: 'defaultshell=/usr/local/bin/zsh'