Skip to content

Commit

Permalink
feat: zero-knowledge install.sh, docs
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Apr 2, 2017
1 parent e9288c2 commit d145b59
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 45 deletions.
90 changes: 73 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,8 @@

Tested on Debian 6, Ubuntu 14.04, Ubuntu 16.04, macOS 10.12, CentOS 7.

Please, check settings in `defaults/main.yml` before provision!
You can test role in vagrant:
```
vagrant up
```

## TODO
- zero-knowledge install
- powerline fonts
- upgrade instructions
- hotkeys
- vagrant only for localhost

## Includes:
- zsh
- tmux (if plugin enabled)
- [antigen](https://github.com/zsh-users/antigen)
- [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
- [powerlevel9k theme](https://github.com/bhilburn/powerlevel9k)
Expand All @@ -34,6 +20,7 @@ vagrant up
- default colors tested with solarized dark and default grey terminal in putty
- add custom prompt elements from yml
- custom zsh config with `~/.zshrc.local` or `/etc/zshrc.local`
- install only plugins that useful for your machine. For example, plugin `docker` will not install if you have not Docker

## 1.5 mins demo
![1.5 mins demo](https://github.com/popstas/popstas.github.io/blob/master/images/2017-03/ansible-role-zsh-demo.gif?raw=true)
Expand All @@ -43,13 +30,42 @@ vagrant up



## Install
## Demo install in Vagrant
You can test work of role before install in real machine.
Just execute `vagrant up`, then `vagrant ssh` for enter in virtual machine.

Note: you cannot install vagrant on VPS like Digital Ocean or in Docker. Use local machine for it.
[Download](https://www.vagrantup.com/downloads.html) and install vagrant for your operating system.



## Install for real machine

### Zero-knowledge install:
If you use Ubuntu or Debian and not familiar with Ansible, you can just execute [install.sh](install.sh) on target machine:
```
curl https://raw.githubusercontent.com/viasite-ansible/ansible-role-zsh/master/install.sh | bash
```
Then [configure terminal application](#configure-terminal-application).


### Manual install

0. [Install Ansible](http://docs.ansible.com/ansible/intro_installation.html).
For Ubuntu:
``` bash
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible
```

1. Download role:
```
ansible-galaxy install viasite-ansible.zsh
```

2. Write playbook:
2. Write playbook or use [playbook.yml](playbook.yml):
```
- hosts: all
vars:
Expand All @@ -60,7 +76,7 @@ ansible-galaxy install viasite-ansible.zsh

3. Provision playbook:
```
ansible-playbook -i "localhost," -c local zsh.yml
ansible-playbook -i "localhost," -c local playbook.yml
```

It will install zsh environment for ansible remote user. If you want to setup zsh for other user,
Expand Down Expand Up @@ -88,6 +104,28 @@ Note: I don't use `tmux-fzf` and don't tested work of it.
## Configure
You should not edit `~/.zshrc`!
Add your custom config to `~/.zshrc.local` (per user) or `/etc/zshrc.local` (global).
`.zshrc.local` will never touched by ansible.


### Configure terminal application
1. Download [powerline fonts](https://github.com/powerline/fonts), install font that you prefer.
You can see screenshots [here](https://github.com/powerline/fonts/blob/master/samples/All.md).

2. Set color scheme.

Personaly, I prefer Solarized Dark color sceme, Droid Sans Mono for Powerline in iTerm and DejaVu Sans Mono in Putty.

#### iTerm
Profiles - Text - Change Font - select font "for Powerline"

Profiles - Colors - Color Presets... - select Solarized Dark

#### Putty
Settings - Window - Appearance - Font settings

You can download [Solarized Dark for Putty](https://github.com/altercation/solarized/tree/master/putty-colors-solarized).



### Hotkeys
You can view hotkeys in [defaults/main.yml](defaults/main.yml), `zsh_hotkeys`.
Expand All @@ -98,3 +136,21 @@ Sample hotkey definitions:
# with dependency of bundle
- { hotkey: '`', action: autosuggest-accept, bundle: zsh-users/zsh-autosuggestions }
```

Useful to set `autosuggest-accept` to <kbd>`</kbd> hotkey, but it conflicts with Midnight Commander (break Ctrl+O subshell).


#### Default hotkeys from plugins:
- <kbd>&rarr;</kbd> - accept autosuggestion
- <kbd>Ctrl+Z</kbd> - move current application to background, press again for return to foreground
- <kbd>Ctrl+G</kbd> - jump to bookmarked directory. Use `mark` in directory for add to bookmarks
- <kbd>Ctrl+R</kbd> - show command history
- <kbd>Ctrl+@</kbd> - show all fzf-widgets
- <kbd>Ctrl+@,C</kbd> - fzf-change-dir, press fast!
- <kbd>Ctrl+\\</kbd> - fzf-change-recent-dir
- <kbd>Ctrl+@,G</kbd> - fzf-change-repository
- <kbd>Ctrl+@,F</kbd> - fzf-edit-files
- <kbd>Ctrl+@,.</kbd> - fzf-edit-dotfiles
- <kbd>Ctrl+@,S</kbd> - fzf-exec-ssh (used your ~/.)
- <kbd>Ctrl+@,G,A</kbd> - fzf-git-add
- <kbd>Ctrl+@,G,B</kbd> - fzf-git-checkout
22 changes: 22 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
title "Install Ansible"
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible

title "Install viasite-ansible.zsh"
ansible-galaxy install viasite-ansible.zsh

title "Download playbook to /tmp/zsh.yml"
curl https://raw.githubusercontent.com/viasite-ansible/ansible-role-zsh/master/playbook.yml > /tmp/zsh.yml

title "Provision playbook"
ansible-playbook -i "localhost," -c local /tmp/zsh.yml

title() {
local color='\033[1;37m'
local nc='\033[0m'
printf "\n${color}$1${nc}\n"
echo -e "$1"
}
57 changes: 29 additions & 28 deletions molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,36 @@
dependency:
name: galaxy

#driver:
# name: docker
#docker:
# containers:
# - name: ansible-role-zsh-ubuntu
# image: ubuntu
# image_version: 16.04
# volume_mounts:
# - ${MOLECULE_APTPROXY_PATH}:/etc/apt/apt.conf.d/00aptproxy
# - name: ansible-role-zsh-centos
# image: centos
# image_version: 7

driver:
name: vagrant
vagrant:
platforms:
- name: xenial64
box: bento/ubuntu-16.04
providers:
- name: virtualbox
type: virtualbox
options:
memory: 512
cpus: 2
instances:
- name: vagrant-01
raw_config_args:
- "vm.synced_folder '${MOLECULE_APT_CONF_D_PATH}', '/etc/apt/apt.conf.d'"
name: docker
docker:
containers:
- name: ansible-role-zsh-ubuntu
image: ubuntu
image_version: 16.04
volume_mounts:
- ${MOLECULE_APTPROXY_PATH}:/etc/apt/apt.conf.d/00aptproxy

- name: ansible-role-zsh-centos
image: centos
image_version: 7

#driver:
# name: vagrant
#vagrant:
# platforms:
# - name: xenial64
# box: bento/ubuntu-16.04
# providers:
# - name: virtualbox
# type: virtualbox
# options:
# memory: 512
# cpus: 2
# instances:
# - name: vagrant-01
# raw_config_args:
# - "vm.synced_folder '${MOLECULE_APT_CONF_D_PATH}', '/etc/apt/apt.conf.d'"

ansible:
playbook: tests/playbook.yml
Expand Down
7 changes: 7 additions & 0 deletions playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- hosts: all
vars:
# your variables here
zsh_autosuggestions_bind_key: "^U"
roles:
- viasite-ansible.zsh
1 change: 1 addition & 0 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
dest: /usr/local/bin
remote_src: yes
creates: /usr/local/bin/fzf
become: yes
when: zsh_register_fzf_command.rc == 1

- name: Set directory permissions
Expand Down

0 comments on commit d145b59

Please sign in to comment.