feat(zsh): add initial role
This commit is contained in:
parent
96c3471242
commit
48744bd22f
14
roles/zsh/README.md
Normal file
14
roles/zsh/README.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
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>
|
20
roles/zsh/defaults/main.yml
Normal file
20
roles/zsh/defaults/main.yml
Normal 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: ""
|
1
roles/zsh/handlers/main.yml
Normal file
1
roles/zsh/handlers/main.yml
Normal file
|
@ -0,0 +1 @@
|
|||
---
|
8
roles/zsh/meta/main.yml
Normal file
8
roles/zsh/meta/main.yml
Normal 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.5
|
||||
galaxy_tags: []
|
||||
dependencies: []
|
23
roles/zsh/tasks/main.yml
Normal file
23
roles/zsh/tasks/main.yml
Normal 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: Template .zshrc
|
||||
include: user.yml
|
||||
loop: "{{ zsh_users }}"
|
22
roles/zsh/tasks/user.yml
Normal file
22
roles/zsh/tasks/user.yml
Normal 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
|
14
roles/zsh/templates/.zshrc.j2
Normal file
14
roles/zsh/templates/.zshrc.j2
Normal 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
2
roles/zsh/vars/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
# vars file for zsh
|
Loading…
Reference in a new issue