Skip to content

Commit

Permalink
Merge pull request #27 from dunkelfrosch/master
Browse files Browse the repository at this point in the history
new playbook: oh-my-zsh integration
  • Loading branch information
cytopia authored May 6, 2018
2 parents 83e83a4 + 6b0666b commit 7223a72
Show file tree
Hide file tree
Showing 12 changed files with 138 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ This is a base idempotent provisioning with sensible defaults that can be slight
<td><a href="https://www.packer.io">packer</a></td>
<td>HashiCorp's packer to build automated machines</td>
</tr>
<tr>
<td><a href="https://github.com/robbyrussell/oh-my-zsh">oh-my-zsh</a></td>
<td>A delightful community-driven framework for managing your zsh configuration.</td>
</tr>
<tr>
<td><a href="https://pinta-project.com/pintaproject/pinta">pinta</a></td>
<td>Open source Paint.Net / MsPaint clone.</td>
Expand Down
1 change: 1 addition & 0 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ libreoffice: 'ignore'
lxdm: 'ignore'
neovim: 'ignore'
network_manager: 'ignore'
oh_my_zsh: 'ignore'
packer: 'ignore'
pinta: 'ignore'
ranger: 'ignore'
Expand Down
1 change: 1 addition & 0 deletions host_vars/debian-stretch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ libreoffice: 'install'
lxdm: 'install'
neovim: 'install'
network_manager: 'install'
oh_my_zsh: 'install'
packer: 'install'
pinta: 'install'
ranger: 'install'
Expand Down
1 change: 1 addition & 0 deletions host_vars/debian-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ libreoffice: 'install'
lxdm: 'install'
neovim: 'install'
network_manager: 'install'
oh_my_zsh: 'install'
packer: 'install'
pinta: 'install'
ranger: 'install'
Expand Down
4 changes: 4 additions & 0 deletions playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@
roles: [network-manager]
tags: network-manager

- hosts: all
roles: [oh-my-zsh]
tags: oh-my-zsh

- hosts: all
roles: [packer]
tags: packer
Expand Down
8 changes: 4 additions & 4 deletions roles/libreoffice/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@
check_mode: no
when: libreoffice_installed.rc == 1

- name: extract libreoffice download link
- name: extract libreoffice real download link
set_fact:
libreoffice_download_link: "{{ libreoffice_mirror_page_raw.content | regex_search(qry) }}"
libreoffice_download_link_base: "{{ libreoffice_mirror_page_raw.content | regex_search(qry) }}"
vars:
qry: 'http://download.documentfoundation.org/libreoffice/.*/[.0-9]+/deb/x86_64/LibreOffice_[.0-9]+_Linux_x86-64_deb.tar.gz'
qry: 'download.documentfoundation.org/libreoffice/.*/[.0-9]+/deb/x86_64/LibreOffice_[.0-9]+_Linux_x86-64_deb.tar.gz'
check_mode: no
when: libreoffice_installed.rc == 1

- name: ensure libreoffice is downloaded
unarchive:
src: "{{ libreoffice_download_link }}"
src: "https://{{ libreoffice_download_link_base }}"
dest: "{{ libreoffice_tmp_dir.path }}"
remote_src: yes
when: libreoffice_installed.rc == 1
Expand Down
4 changes: 4 additions & 0 deletions roles/oh-my-zsh/default/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

# 'install', 'remove' or 'ignore'
oh_my_zsh: 'ignore'
46 changes: 46 additions & 0 deletions roles/oh-my-zsh/files/zshrc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# For Solarized
export TERM="xterm-256color"

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
# ZSH_THEME="steeef"
ZSH_THEME="{{ zsh_theme }}"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Comment this out to disable bi-weekly auto-update checks
DISABLE_AUTO_UPDATE="true"

# Uncomment to change how many often would you like to wait before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git cp command-not-found git-extras gnu-utils history pip python ruby screen ssh-agent svn)

source $ZSH/oh-my-zsh.sh

# Customize to your needs...
export PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
31 changes: 31 additions & 0 deletions roles/oh-my-zsh/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
- name: ensure requirements are installed
include_role:
name: apt-meta
vars:
apt_packages:
- "{{ oh_my_zsh_shared_packages }}"

- name: Clone oh-my-zsh repo
git: repo=https://github.com/robbyrussell/oh-my-zsh.git dest=/root/.oh-my-zsh
become: yes

- name: Create conf folder in home directory
file: path=/root/conf/ state=directory owner=root
become: yes

- name: deploy .zshrc
template: src=../files/zshrc.in dest=/root/conf/zshrc owner=root
become: yes

- name: remove standard zshrc
file: path=/root/.zshrc state=absent
become: yes

- name: symlink zshrc
file: path=/root/.zshrc src=/root/conf/zshrc state=link owner=root force=true
become: yes

- name: Set zsh as default shell
user: name=root shell=/bin/zsh
become: yes
7 changes: 7 additions & 0 deletions roles/oh-my-zsh/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

- include_tasks: install.yml
when: oh_my_zsh == 'install'

- include_tasks: uninstall.yml
when: oh_my_zsh == 'remove'
28 changes: 28 additions & 0 deletions roles/oh-my-zsh/tasks/uninstall.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
- name: reset bash as default shell
user: name=root shell=/bin/bash
become: yes

- name: ensure requirements are removed
include_role:
name: apt-meta
vars:
apt_state: absent
apt_packages:
- "{{ oh_my_zsh_shared_packages }}"

- name: remove zshrc and oh-my-zsh base path
file: path=/root/.oh-my-zsh state=absent
become: yes

- name: remove oh-my-zsh-conf path
file: path=/root/conf state=absent
become: yes

- name: remove oh-my-zsh-rc symlink
file: path=/root/.zshrc state=absent
become: yes

- name: remove oh-my-zsh-history file
file: path=/root/.zsh_history state=absent
become: yes
7 changes: 7 additions & 0 deletions roles/oh-my-zsh/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

oh_my_zsh_shared_packages:
- git-core
- zsh

zsh_theme: steeef

0 comments on commit 7223a72

Please sign in to comment.