summaryrefslogtreecommitdiff
path: root/roles/core/zsh/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/core/zsh/tasks/main.yml')
-rw-r--r--roles/core/zsh/tasks/main.yml58
1 files changed, 58 insertions, 0 deletions
diff --git a/roles/core/zsh/tasks/main.yml b/roles/core/zsh/tasks/main.yml
new file mode 100644
index 00000000..a5ae60ec
--- /dev/null
+++ b/roles/core/zsh/tasks/main.yml
@@ -0,0 +1,58 @@
+---
+- 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: "{{ zsh_conf_base_dir }}/zshrc"
+ - src: "zshrc.skel"
+ dest: "/etc/skel/.zshrc"
+ loop_control:
+ label: "{{ item.dest }}"
+ copy:
+ src: "{{ item.src }}"
+ dest: "{{ item.dest }}"
+
+- name: set zsh as default shell
+ loop: "{{ [ 'root' ] | union(zsh_loginshell_user | default([])) }}"
+ user:
+ name: "{{ item }}"
+ shell: "{{ zsh_bin_path }}"
+
+- 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:
+ path: "{{ item.key }}"
+ regexp: "{{ item.value.regexp }}"
+ line: "{{ item.value.line }}"
+ create: yes
+
+- name: install shell banner
+ when: zsh_banner is defined
+ block:
+
+ - name: install banner script
+ template:
+ src: "banner.{{ zsh_banner }}.j2"
+ dest: /etc/banner.sh
+ mode: 0755
+
+ - name: enable banner for zsh login
+ lineinfile:
+ path: "{{ zsh_conf_base_dir }}/zlogin"
+ line: /etc/banner.sh
+ insertbefore: "^## END OF FILE #"
+ create: yes