summaryrefslogtreecommitdiff
path: root/roles/zsh/tasks/main.yml
blob: f0aa696e5b861d1058961720c6aea8e6cbf62432 (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
48
49
50
51
52
53
---
- name: install zsh packages
  openbsd_pkg:
    name: zsh
    state: present

- name: install zsh-config
  loop:
  - src: "zshrc"
    dest: "/etc/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: /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

- name: make zsh the default shell for adduser
  lineinfile:
    regexp: '^#?defaultshell='
    line: 'defaultshell=/usr/local/bin/zsh'
    path: /etc/adduser.conf
    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: /etc/zlogin
        line: /etc/banner.sh
        insertbefore: "^## END OF FILE #"
        create: yes