Skip to content

Commit

Permalink
Create bash aliases using new 'misc' role
Browse files Browse the repository at this point in the history
  • Loading branch information
radomirbosak committed Dec 25, 2016
1 parent 2745753 commit 8e67ec5
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 16 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ fedora-setup
My custom fedora setup using ansible.

Currently it installs and configures fish shell, git, sublime_text, docker. Sets gnome keyboard shortcuts and enables the minimize button.
Also various packages are installed.

Usage
-----
Expand Down
17 changes: 1 addition & 16 deletions main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,4 @@
- sublime_text
- gnome
- docker
tasks:
- name: install CLI packages
dnf: state=present name={{ item }}
with_items: "{{ cli_packages }}"
become: true
tags:
- root
- cli

- name: install GUI packages
dnf: state=present name={{ item }}
with_items: "{{ gui_packages }}"
become: true
tags:
- root
- gui
- misc
2 changes: 2 additions & 0 deletions roles/misc/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cli_packages: []
gui_packages: []
5 changes: 5 additions & 0 deletions roles/misc/files/ansible-aliases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alias l="ls -a --color=auto"
alias ll="ls -lahv --time-style=long-iso --color=auto"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
6 changes: 6 additions & 0 deletions roles/misc/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- include: misc-root.yml
tags: root

- include: misc-user.yml
tags: user
16 changes: 16 additions & 0 deletions roles/misc/tasks/misc-root.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: install CLI packages
dnf: state=present name={{ item }}
with_items: "{{ cli_packages }}"
become: true
tags:
- root
- cli

- name: install GUI packages
dnf: state=present name={{ item }}
with_items: "{{ gui_packages }}"
become: true
tags:
- root
- gui
15 changes: 15 additions & 0 deletions roles/misc/tasks/misc-user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: create .bashrc.d directory
file:
path: "{{ ansible_env.HOME }}/.bashrc.d"
state: directory

- name: copy the file with aliases
copy:
src: files/ansible-aliases.sh
dest: "{{ ansible_env.HOME }}/.bashrc.d/"

- name: ensure the all files in .bashrc.d get sourced
lineinfile:
dest: "{{ ansible_env.HOME }}/.bashrc"
line: "for f in ~/.bashrc.d/*; do source $f; done"

0 comments on commit 8e67ec5

Please sign in to comment.