From d2f5548a574ddbc4b4077161966a63e3ce60f4ef Mon Sep 17 00:00:00 2001 From: Tobias Stein Date: Sat, 10 Dec 2022 20:09:27 +0100 Subject: [PATCH] Add ZSH config --- roles/fai/tasks/zsh.yml | 120 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 roles/fai/tasks/zsh.yml diff --git a/roles/fai/tasks/zsh.yml b/roles/fai/tasks/zsh.yml new file mode 100644 index 0000000..6bdda22 --- /dev/null +++ b/roles/fai/tasks/zsh.yml @@ -0,0 +1,120 @@ +### ZSH +- name: "zsh - grml-config" + become: true + ansible.builtin.git: + repo: 'git://git.grml.org/grml-etc-core.git' + dest: "/opt/grml-etc-core" + version: HEAD + tags: + - grml + - zsh + - zshrc + +- name: "zsh - stat '/etc/zsh'" + ansible.builtin.stat: + path: "/etc/zsh" + register: etc_zsh + tags: + - grml + - zsh + - zshrc + +- name: "zsh - debug variable 'etc_zsh'" + ansible.builtin.debug: + var: etc_zsh + verbosity: 2 + when: + - etc_zsh.stat.exists + tags: + - debug + - grml + - zsh + - zshrc + +- name: "zsh - debug path '/etc/zsh' and path type" + ansible.builtin.debug: + msg: > + "zsh - path '/etc/zsh' exists" + "and the chack for symlink is {{ etc_zsh.stat.islnk }}" + verbosity: 2 + when: + - etc_zsh.stat.islnk is defined + tags: + - debug + - grml + - zsh + - zshrc + +- name: "zsh - move '/etc/zsh' to '/etc/zsh.dist'" + become: true + ansible.builtin.command: > + mv -v "/etc/zsh" "/etc/zsh.dist" + when: + - etc_zsh.stat.islnk is defined + - not etc_zsh.stat.islnk + register: etc_zsh_mv + tags: + - grml + - zsh + - zshrc + +- name: "zsh - debug variable 'etc_zsh_mv'" + ansible.builtin.debug: + var: etc_zsh_mv + verbosity: 2 + when: + - etc_zsh_mv.changed + +- name: "zsh - sym-link '/etc/zsh' to '/opt/grml-etc-core/etc/zsh'" + become: true + ansible.builtin.file: + src: "/opt/grml-etc-core/etc/zsh" + path: "/etc/zsh" + state: link + owner: root + group: root + when: + - etc_zsh_mv.changed + - etc_zsh_mv.failed is defined + - not etc_zsh_mv.failed + tags: + - grml + - zsh + - zshrc + +- name: "zsh - stat '/etc/zsh'" + ansible.builtin.stat: + path: "/etc/zsh" + register: etc_zsh + when: + tags: + - grml + - zsh + - zshrc + +- name: "Show variable 'etc_zsh'" + ansible.builtin.debug: + var: etc_zsh + verbosity: 2 + when: + - etc_zsh.stat.exists + tags: + - grml + - zsh + - zshrc + +- name: "zsh - make zsh default shell for selected users" + become: true + ansible.builtin.user: + name: "{{ item }}" + shell: "/bin/zsh" + loop: + - rockstable + when: + - etc_zsh.stat.exists is defined + - etc_zsh.stat.exists + tags: + - grml + - zsh + - zshrc +