initial commit
This commit is contained in:
27
roles/gantsign.oh-my-zsh/tasks/debian-console-setup.yml
Normal file
27
roles/gantsign.oh-my-zsh/tasks/debian-console-setup.yml
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
# This is for the boot console only (i.e. not xterm, ssh or docker).
|
||||
# The oh-my-zsh prompt appears corrupted unless the console is in UTF-8.
|
||||
# If the console-setup file is missing don't create it... assume we're
|
||||
# running in an environment without a boot console (e.g. docker).
|
||||
- name: check if console-setup exists
|
||||
stat:
|
||||
path: /etc/default/console-setup
|
||||
register: console_setup_file
|
||||
|
||||
- name: install console-setup
|
||||
become: yes
|
||||
apt:
|
||||
name: console-setup
|
||||
state: present
|
||||
when: console_setup_file.stat.exists
|
||||
|
||||
- name: edit console-setup to utf-8
|
||||
become: yes
|
||||
lineinfile:
|
||||
dest: /etc/default/console-setup
|
||||
regexp: ^CHARMAP=
|
||||
line: CHARMAP="UTF-8"
|
||||
state: present
|
||||
when: console_setup_file.stat.exists
|
||||
notify:
|
||||
- dpkg-reconfigure console-setup
|
72
roles/gantsign.oh-my-zsh/tasks/install.yml
Normal file
72
roles/gantsign.oh-my-zsh/tasks/install.yml
Normal file
@ -0,0 +1,72 @@
|
||||
---
|
||||
- name: install dependencies
|
||||
package:
|
||||
name: '{{ item }}'
|
||||
state: present
|
||||
with_items:
|
||||
- git
|
||||
- zsh
|
||||
|
||||
- name: clone oh-my-zsh for users
|
||||
tags:
|
||||
# Suppress warning: [ANSIBLE0006] git used in place of git module
|
||||
# Git module doesn't allow us to set `core.autocrlf=input`.
|
||||
- skip_ansible_lint
|
||||
become: yes
|
||||
become_user: '{{ item.username }}'
|
||||
# core.autocrlf=input prevents https://github.com/robbyrussell/oh-my-zsh/issues/4402
|
||||
command: 'git clone -c core.autocrlf=input --depth=1 https://github.com/robbyrussell/oh-my-zsh.git .oh-my-zsh'
|
||||
args:
|
||||
chdir: '~{{ item.username }}'
|
||||
creates: '~{{ item.username }}/.oh-my-zsh'
|
||||
with_items: '{{ users }}'
|
||||
|
||||
- name: retrieve powerlevel9k theme from repo
|
||||
become: yes
|
||||
become_user: '{{ item.username }}'
|
||||
git:
|
||||
repo: 'https://github.com/bhilburn/powerlevel9k.git'
|
||||
dest: '~{{ item.username }}/.oh-my-zsh/custom/themes/powerlevel9k'
|
||||
with_items: '{{ users }}'
|
||||
|
||||
- name: retrieve powerline fonts
|
||||
become: yes
|
||||
become: '{{ item.username }}'
|
||||
git:
|
||||
repo: 'https://github.com/ryanoasis/nerd-fonts.git'
|
||||
dest: '~{{ item.username }}/.fonts'
|
||||
with_items: '{{ users }}'
|
||||
|
||||
- name: install powerline fonts
|
||||
become: yes
|
||||
become: '{{ item.username }}'
|
||||
command: '~{{ item.username }}/.fonts/install.sh'
|
||||
with_items: '{{ users }}'
|
||||
|
||||
- name: set permissions of oh-my-zsh for users
|
||||
become: yes
|
||||
file:
|
||||
path: '~{{ item.username }}/.oh-my-zsh'
|
||||
# Prevent the cloned repository from having insecure permissions. Failing to do
|
||||
# so causes compinit() calls to fail with "command not found: compdef" errors
|
||||
# for users with insecure umasks (e.g., "002", allowing group writability).
|
||||
mode: 'go-w'
|
||||
recurse: yes
|
||||
with_items: '{{ users }}'
|
||||
|
||||
- name: set default shell for users
|
||||
become: yes
|
||||
user:
|
||||
name: '{{ item.username }}'
|
||||
shell: /bin/zsh
|
||||
with_items: '{{ users }}'
|
||||
|
||||
- name: write .zshrc for users
|
||||
become: yes
|
||||
become_user: '{{ item.username }}'
|
||||
template:
|
||||
src: zshrc.j2
|
||||
dest: '~{{ item.username }}/.zshrc'
|
||||
backup: yes
|
||||
mode: 'u=rw,go=r'
|
||||
with_items: '{{ users }}'
|
6
roles/gantsign.oh-my-zsh/tasks/main.yml
Normal file
6
roles/gantsign.oh-my-zsh/tasks/main.yml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
- import_tasks: install.yml
|
||||
|
||||
- name: console setup for Debian family distributions
|
||||
include_tasks: debian-console-setup.yml
|
||||
when: ansible_os_family == 'Debian'
|
Reference in New Issue
Block a user