From 3a2319c9c58886a7938deabafc66ad4bc128c9f8 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 31 May 2020 23:12:36 +0200 Subject: move core roles to subdir --- roles/core/zsh/tasks/main.yml | 58 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 roles/core/zsh/tasks/main.yml (limited to 'roles/core/zsh/tasks') 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 -- cgit v1.2.3