Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
igormukhingmailcom committed Jan 12, 2015
0 parents commit 24890ed
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{yml,yml.dist,yml.js2}]
indent_style = space
indent_size = 2
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Igor Mukhin <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ansible-role-bash_aliases

Ansible role for setting aliases in ~/.bash_aliases for Debian/Ubuntu.

## Prerequisites

First of all you should install [Ansible](http://www.ansible.com/home) on your machine, official [docs](http://docs.ansible.com/intro_installation.html) should help you with that.

# Installation
```bash
ansible-galaxy install igor_mukhin.bash_aliases,v0.1.0
```

## Example playbook

Lets make aliases for symfony2 console command

```yml
# playbook.yml

vars:
# See all available variables at defaults/main.yml
bash_aliases:
- { alias: 'sf', command: 'php app/console' }

- { alias: 'sfcc', command: 'sf cache:clear' }
- { alias: 'sfccnw', command: 'sfcc --no-warmup' }

- { alias: 'sfl', command: 'sf list' }
- { alias: 'sflg', command: 'sf list | grep' }

roles:
- igor_mukhin.bash_aliases

```
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
bash_aliases_path: "~/.bash_aliases"
bash_aliases_mode: 0644
bash_aliases: false
17 changes: 17 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
dependencies: []

galaxy_info:
author: igor_mukhin
description: Set aliases in ~/.bash_aliases for Debian/Ubuntu
license: "MIT"
min_ansible_version: 1.4
platforms:
- name: Ubuntu
versions:
- all
- name: Debian
versions:
- all
categories:
- system
10 changes: 10 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Add custom bash aliases
lineinfile:
dest: "{{ bash_aliases_path }}"
create: yes
mode: "{{ bash_aliases_mode }}"
line: "alias {{ item.alias }}='{{ item.command }}'"
regexp: "^alias {{ item.alias }}="
with_items: bash_aliases
when: bash_aliases != false
1 change: 1 addition & 0 deletions tests/bash_aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alias sf='php app/console2'
11 changes: 11 additions & 0 deletions tests/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

- hosts: all
sudo: true

vars:
bash_aliases:
- { alias: 'sf', command: 'php app/console2' }

roles:
- "../../igor_mukhin.bash_aliases"

0 comments on commit 24890ed

Please sign in to comment.