This repository has been archived by the owner on Sep 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from loliee/improvements-serverspec
Improvements serverspec
- Loading branch information
Showing
20 changed files
with
334 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--color | ||
--format documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'serverspec' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
diff-lcs (1.2.5) | ||
multi_json (1.11.1) | ||
net-scp (1.2.1) | ||
net-ssh (>= 2.6.5) | ||
net-ssh (2.9.2) | ||
rspec (3.3.0) | ||
rspec-core (~> 3.3.0) | ||
rspec-expectations (~> 3.3.0) | ||
rspec-mocks (~> 3.3.0) | ||
rspec-core (3.3.1) | ||
rspec-support (~> 3.3.0) | ||
rspec-expectations (3.3.0) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.3.0) | ||
rspec-its (1.2.0) | ||
rspec-core (>= 3.0.0) | ||
rspec-expectations (>= 3.0.0) | ||
rspec-mocks (3.3.1) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.3.0) | ||
rspec-support (3.3.0) | ||
serverspec (2.19.0) | ||
multi_json | ||
rspec (~> 3.0) | ||
rspec-its | ||
specinfra (~> 2.35) | ||
specinfra (2.36.6) | ||
net-scp | ||
net-ssh | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
serverspec | ||
|
||
BUNDLED WITH | ||
1.10.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Ansible Role: ZSH | ||
|
||
[![Build Status](https://travis-ci.org/loliee/ansible-zsh.svg?branch=master)](https://travis-ci.org/loliee/ansible-zsh) | ||
|
||
Install and set up [ZSH](http://www.zsh.org/). | ||
This role can also configure `~./zshrc` file and download and set up `prompt`. | ||
|
||
## Requirements | ||
|
||
- RedHat family | ||
- Debian family | ||
- OSX (Configuration part) | ||
|
||
## Role Variables | ||
|
||
### `__users__` | ||
|
||
Unset by default, dictionary should defined like this: | ||
|
||
```yaml | ||
__users__: | ||
[username]: | ||
[option]: [value] | ||
``` | ||
**Options** | ||
| Option | Type | Comments | | ||
|---------------------------|----------|---------------------------------------------------------------| | ||
| zsh_default_shell | bool | Configure as default shell. Create `.zshrc`and `.zfunctions`. | | ||
| zsh_prompt_install | bool | Install prompt ?, default value is `No` | | ||
| zsh_prompt_name | string | Prompt name to load in `.zshrc`. | | ||
| zsh_prompt_download_url | string | Prompt download url, e.g [pure](https://github.com/sindresorhus/pure) | | ||
| zsh_prompt_additional_url | string | Prompt additional download url to put in `.zfunctions`. | | ||
| zsh_zfunctions_directory | string | Directory of files to upload on remote `.zfunctions`. | | ||
| zsh_zshrc_content | text | Lines to append in `~/.zshrc`. | | ||
|
||
|
||
### Defaults | ||
|
||
Check [defaults/main.yml](defaults/main.yml) for default values. | ||
|
||
|
||
| Variable | Type | Comments | | ||
|-----------------------------------|----------|-----------------------------------------------------| | ||
| zsh_default_prompt_name | string | Default prompt_name, `mlpure`. | | ||
| zsh_default_prompt_download_url | string | Prompt download url, [mlpure](https://github.com/loliee/mlpure) | | ||
| zsh_default_prompt_additional_url | text | `mlpure` async lib. |Ó | ||
|
||
|
||
## Example Playbook | ||
|
||
The following playbook will ensure zsh is present for root user and will setup pure as prompt. This playbook will also append an alias in zshrc file. | ||
|
||
```yaml | ||
# ./test/playbooks/configuration.yml | ||
- hosts: localhost | ||
remote_user: root | ||
vars: | ||
__users__: | ||
root: | ||
zsh_prompt_install: Yes | ||
zsh_prompt_name: pure | ||
zsh_prompt_download_url: https://raw.githubusercontent.com/sindresorhus/pure/master/pure.zsh | ||
zsh_prompt_additional_url: https://raw.githubusercontent.com/sindresorhus/pure/master/async.zsh | ||
zfunctions_directory: ./files/zfunctions | ||
zshrc_content: | | ||
alias ls='ls -lah' | ||
# Run | ||
roles: | ||
- zsh | ||
``` | ||
|
||
## Run Tests | ||
|
||
Require [serverspec](http://serverspec.org/). | ||
Check [.travis.yml](.travis.yml) for details. | ||
|
||
## Licence | ||
|
||
MIT © [Maxime Loliée](https://github.com/loliee.com/) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
|
||
zsh_default_prompt_name: mlpure | ||
zsh_default_prompt_download_url: https://raw.githubusercontent.com/loliee/mlpure/master/pure.zsh | ||
zsh_default_prompt_additional_url: https://raw.githubusercontent.com/loliee/mlpure/master/async.zsh |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
# Setup zshrc and prompt | ||
|
||
- name: Set as default shell | ||
user: name={{ item.key }} shell=/bin/zsh | ||
with_dict: __users__ | default({}) | ||
when: > | ||
(ansible_os_family == 'RedHat' or ansible_os_family == 'Debian') and | ||
(item.value.has_key('zsh_default_shell') and item.value.zsh_default_shell) | ||
- name: Generate ~.zshrc. | ||
template: | ||
mode=0644 | ||
src=zshrc.j2 | ||
owner={{ item.key }} | ||
dest=~{{ item.key }}/.zshrc | ||
with_dict: __users__ | default({}) | ||
when: (item.value.has_key('zsh_default_shell') and item.value.zsh_default_shell) | ||
|
||
- name: Check for .zfunctions directory. | ||
file: | ||
state=directory | ||
mode=0755 | ||
owner={{ item.key }} | ||
dest=~{{ item.key }}/.zfunctions | ||
with_dict: __users__ | default({}) | ||
when: (item.value.has_key('zsh_default_shell') and item.value.zsh_default_shell) | ||
|
||
- name: Upload zfunctions files | ||
copy: | ||
src=./{{ item.value.zsh_zfunctions_directory }}/ | ||
dest=~{{ item.key }}/.zfunctions/ | ||
owner={{ item.key }} | ||
directory_mode=yes | ||
force=yes | ||
mode=0755 | ||
with_dict: __users__ | default({}) | ||
when: > | ||
item.value.has_key('zsh_zfunctions_directory') | ||
- name: Download zsh prompt file. | ||
get_url: | ||
mode=0744 | ||
owner={{ item.key }} | ||
url={{ item.value.zsh_prompt_download_url | default(zsh_default_prompt_download_url) }} | ||
dest=~{{ item.key }}/.zfunctions/prompt_{{ item.value.zsh_prompt_name | default(zsh_default_prompt_name) }}_setup | ||
with_dict: __users__ | default({}) | ||
when: item.value.has_key('zsh_prompt_install') and item.value.zsh_prompt_install | ||
|
||
- name: Download zsh prompt additional file. | ||
get_url: | ||
mode=0744 | ||
owner={{ item.key }} | ||
url={{ item.value.zsh_prompt_additional_url }} | ||
dest=~{{ item.key }}/.zfunctions/{{ zsh_prompt_additional_url | basename | replace('.zsh', '') }} | ||
with_dict: __users__ | default({}) | ||
when: > | ||
item.value.has_key('zsh_prompt_install') and item.value.zsh_prompt_install and | ||
item.value.has_key('zsh_prompt_additional_url') and item.value.zsh_prompt_additional_url | ||
- name: Download zsh additional file if install default prompt. | ||
get_url: | ||
mode=0744 | ||
owner={{ item.key }} | ||
url={{ zsh_default_prompt_additional_url }} | ||
dest=~{{ item.key }}/.zfunctions/{{ zsh_default_prompt_additional_url | basename | replace('.zsh', '') }} | ||
with_dict: __users__ | default({}) | ||
when: > | ||
item.value.has_key('zsh_prompt_install') and item.value.zsh_prompt_install and not | ||
item.value.has_key('zsh_prompt_name') |
Oops, something went wrong.