Add ZSH config

This commit is contained in:
rockstable 2022-12-10 20:09:27 +01:00
parent 99d449b0eb
commit d2f5548a57
1 changed files with 120 additions and 0 deletions

120
roles/fai/tasks/zsh.yml Normal file
View File

@ -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