diff --git a/roles/zsh/README.md b/roles/zsh/README.md new file mode 100644 index 0000000..aa9574f --- /dev/null +++ b/roles/zsh/README.md @@ -0,0 +1,11 @@ +# zsh + +Install and configure zsh and antigen + +## License + +[CNPLv7+](https://thufie.lain.haus/NPL.html) + +## Author Information + +- [Jan Christian Grünhage](https://jcg.re) diff --git a/roles/zsh/defaults/main.yml b/roles/zsh/defaults/main.yml new file mode 100644 index 0000000..803e6fa --- /dev/null +++ b/roles/zsh/defaults/main.yml @@ -0,0 +1,20 @@ +--- +antigen_repo: https://github.com/zsh-users/antigen.git +antigen_version: v2.2.3 +antigen_path: /opt/antigen + +antigen_plugins: +- zsh-users/zsh-syntax-highlighting +- zsh-users/zsh-autosuggestions +- zsh-users/zsh-completions + +antigen_theme: gnzh + +zsh_users: +- name: root + home_path: /root + plugins: "{{ antigen_plugins }}" + theme: "{{ antigen_theme }}" + zshrc_extra: "{{ zsh_zshrc_extra }}" + +zsh_zshrc_extra: "" diff --git a/roles/zsh/handlers/main.yml b/roles/zsh/handlers/main.yml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/roles/zsh/handlers/main.yml @@ -0,0 +1 @@ +--- diff --git a/roles/zsh/meta/main.yml b/roles/zsh/meta/main.yml new file mode 100644 index 0000000..2bb3ad1 --- /dev/null +++ b/roles/zsh/meta/main.yml @@ -0,0 +1,8 @@ +--- +galaxy_info: + author: Jan Christian Grünhage + description: Install and configure zsh with antigen + license: CPNLv7+ + min_ansible_version: 2.9 + galaxy_tags: [] +dependencies: [] diff --git a/roles/zsh/tasks/main.yml b/roles/zsh/tasks/main.yml new file mode 100644 index 0000000..41c0cdb --- /dev/null +++ b/roles/zsh/tasks/main.yml @@ -0,0 +1,23 @@ +--- +- name: Install zsh + package: + name: + - git + - zsh + become: yes +- name: Clone antigen + git: + repo: "{{ antigen_repo }}" + dest: "{{ antigen_path }}" + version: "{{ antigen_version }}" + become: yes +- name: Make antigen world readable + file: + path: "{{ antigen_path }}" + state: directory + recurse: true + mode: "a+rX" + become: yes +- name: Execute user specific tasks + include: user.yml + loop: "{{ zsh_users }}" diff --git a/roles/zsh/tasks/user.yml b/roles/zsh/tasks/user.yml new file mode 100644 index 0000000..04a9709 --- /dev/null +++ b/roles/zsh/tasks/user.yml @@ -0,0 +1,22 @@ +--- +- name: Template zshrc + template: + src: .zshrc.j2 + dest: "{{ item.home_path }}/.zshrc" + owner: "{{ item.name }}" + group: "{{ item.name }}" + become: yes +- name: Set default shell + user: + name: "{{ item.name }}" + shell: "/bin/zsh" + become: yes +- name: Ensure ~/.profile exists + file: + path: "{{ item.home_path }}/.profile" + state: touch + access_time: preserve + modification_time: preserve + owner: "{{ item.name }}" + group: "{{ item.name }}" + become: yes diff --git a/roles/zsh/templates/.zshrc.j2 b/roles/zsh/templates/.zshrc.j2 new file mode 100644 index 0000000..c51f3a6 --- /dev/null +++ b/roles/zsh/templates/.zshrc.j2 @@ -0,0 +1,14 @@ +source {{ antigen_path }}/bin/antigen.zsh + +antigen use oh-my-zsh +antigen bundle <