mirror of
https://github.com/KevinMidboe/playbooks-retailor.git
synced 2026-01-10 11:25:44 +00:00
ansible playbooks for retailor.io infrastructure
This commit is contained in:
84
roles/oh-my-zsh/tasks/install.yml
Normal file
84
roles/oh-my-zsh/tasks/install.yml
Normal file
@@ -0,0 +1,84 @@
|
||||
---
|
||||
- name: install dependencies
|
||||
become: true
|
||||
become_user: 'root'
|
||||
# become: "{{ ansible_distribution != 'MacOSX' }}"
|
||||
package:
|
||||
name:
|
||||
- git
|
||||
- zsh
|
||||
state: present
|
||||
with_items: "{{ users }}"
|
||||
when: "((user.oh_my_zsh | default({})).install | default(oh_my_zsh_install)) | bool"
|
||||
loop_control:
|
||||
loop_var: user
|
||||
label: '{{ user.username }}'
|
||||
|
||||
- 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: true
|
||||
become_user: '{{ user.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: '~{{ user.username }}'
|
||||
creates: '~{{ user.username }}/.oh-my-zsh'
|
||||
with_items: "{{ users }}"
|
||||
when: "((user.oh_my_zsh | default({})).install | default(oh_my_zsh_install)) | bool"
|
||||
loop_control:
|
||||
loop_var: user
|
||||
label: '{{ user.username }}'
|
||||
|
||||
- name: set permissions of oh-my-zsh for users
|
||||
become: true
|
||||
file:
|
||||
path: '~{{ user.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: true
|
||||
with_items: "{{ users }}"
|
||||
when: "((user.oh_my_zsh | default({})).install | default(oh_my_zsh_install)) | bool"
|
||||
loop_control:
|
||||
loop_var: user
|
||||
label: '{{ user.username }}'
|
||||
|
||||
- name: set default shell for users
|
||||
become: true
|
||||
user:
|
||||
name: '{{ user.username }}'
|
||||
shell: /bin/zsh
|
||||
with_items: "{{ users }}"
|
||||
when: "((user.oh_my_zsh | default({})).install | default(oh_my_zsh_install)) | bool"
|
||||
loop_control:
|
||||
loop_var: user
|
||||
label: '{{ user.username }}'
|
||||
|
||||
- name: write .zshrc for users
|
||||
become: true
|
||||
become_user: '{{ user.username }}'
|
||||
template:
|
||||
src: zshrc.j2
|
||||
dest: '~{{ user.username }}/.zshrc'
|
||||
backup: true
|
||||
mode: 'u=rw,go=r'
|
||||
with_items: '{{ users }}'
|
||||
when: "((user.oh_my_zsh | default({})).install | default(oh_my_zsh_install)) | bool"
|
||||
loop_control:
|
||||
loop_var: user
|
||||
label: '{{ user.username }}'
|
||||
|
||||
- name: add custom template theme
|
||||
template:
|
||||
src: robbyrussell_zsh_theme.j2
|
||||
dest: '~{{ user.username }}/.oh-my-zsh/custom/themes/robbyrussell.zsh-theme'
|
||||
mode: 'u=rw,go=r'
|
||||
with_items: '{{ users }}'
|
||||
loop_control:
|
||||
loop_var: user
|
||||
label: '{{ user.username }}'
|
||||
|
||||
Reference in New Issue
Block a user