summaryrefslogtreecommitdiff
path: root/roles/zsh/tasks/main.yml
blob: 9924b44bb1c83c4b79da41a719a3b6d944603744 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
- name: install zsh packages
  apt:
    name: zsh
    state: present

- name: install zsh-config
  copy:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
  with_items:
  - { src: "zshrc", dest: "/etc/zsh/zshrc" }
  - { src: "zshrc.skel", dest: "/etc/skel/.zshrc" }

- name: set zsh as default shell
  user:
    name: "{{ item }}"
    shell: /bin/zsh
  with_items: "{{ [ 'root' ] | union(zsh_loginshell_user | default([])) }}"

- name: make zsh the default shell for useradd
  lineinfile:
    regexp: '^#?SHELL='
    line: 'SHELL=/bin/zsh'
    path: /etc/default/useradd

- name: make zsh the default shell for adduser
  lineinfile:
    regexp: '^#?DSHELL='
    line: 'DSHELL=/bin/zsh'
    path: /etc/adduser.conf

- 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: /etc/zsh/zlogin
        line: /etc/banner.sh
        insertbefore: "^## END OF FILE #"