feat(zsh): add initial role

This commit is contained in:
Jan Christian Grünhage 2021-09-04 09:30:36 +02:00
parent 96c3471242
commit b6d99a1efd
8 changed files with 101 additions and 0 deletions

11
roles/zsh/README.md Normal file
View File

@ -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) <jan.christian@gruenhage.xyz>

View File

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

View File

@ -0,0 +1 @@
---

8
roles/zsh/meta/main.yml Normal file
View File

@ -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: []

23
roles/zsh/tasks/main.yml Normal file
View File

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

22
roles/zsh/tasks/user.yml Normal file
View File

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

View File

@ -0,0 +1,14 @@
source {{ antigen_path }}/bin/antigen.zsh
antigen use oh-my-zsh
antigen bundle <<EOBUNDLES
{% for plugin in item.plugins %}
{{ plugin }}
{% endfor %}
EOBUNDLES
antigen theme {{ item.theme }}
antigen apply
source ~/.profile
{{ item.zshrc_extra }}

2
roles/zsh/vars/main.yml Normal file
View File

@ -0,0 +1,2 @@
---
# vars file for zsh