summaryrefslogtreecommitdiff
path: root/roles/zsh/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/zsh/tasks/main.yml')
-rw-r--r--roles/zsh/tasks/main.yml35
1 files changed, 20 insertions, 15 deletions
diff --git a/roles/zsh/tasks/main.yml b/roles/zsh/tasks/main.yml
index f0aa696e..a5ae60ec 100644
--- a/roles/zsh/tasks/main.yml
+++ b/roles/zsh/tasks/main.yml
@@ -1,13 +1,21 @@
---
-- name: install zsh packages
- openbsd_pkg:
+- 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/zshrc"
+ dest: "{{ zsh_conf_base_dir }}/zshrc"
- src: "zshrc.skel"
dest: "/etc/skel/.zshrc"
loop_control:
@@ -20,19 +28,16 @@
loop: "{{ [ 'root' ] | union(zsh_loginshell_user | default([])) }}"
user:
name: "{{ item }}"
- shell: /usr/local/bin/zsh
-
-- name: make zsh the default shell for useradd
- lineinfile:
- regexp: '^#?shell\s'
- line: 'shell /usr/local/bin/zsh'
- path: /etc/usermgmt.conf
+ 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: '^#?defaultshell='
- line: 'defaultshell=/usr/local/bin/zsh'
- path: /etc/adduser.conf
+ path: "{{ item.key }}"
+ regexp: "{{ item.value.regexp }}"
+ line: "{{ item.value.line }}"
create: yes
- name: install shell banner
@@ -47,7 +52,7 @@
- name: enable banner for zsh login
lineinfile:
- path: /etc/zlogin
+ path: "{{ zsh_conf_base_dir }}/zlogin"
line: /etc/banner.sh
insertbefore: "^## END OF FILE #"
create: yes