ckaserer.bashrc
ckaserer.bashrc
If you spend a lot of time using the command line interface (CLI) like I do, you might want to add some color to your setup. This custom bashrc gives you a bash prompt that stretches over two lines, allowing you to see your user, host, current path, and git branch at a glance if you're in a git repository. Plus, commands like ls
and grep
will show colors if your system can do that.
Let's Add Some Color and Git Support to Your Bash!
You have two options for using the bashrc role. You can enable it for just the user that Ansible connects with on the target nodes, or you can set it as the default for all users on the system.
In either case, you need to install the latest version of the bashrc Ansible role from Ansible Galaxy:
ansible-galaxy install ckaserer.bashrc
For a Single User
The playbook below will download the latest bashrc version and enable it for your current user on your current terminal.
Alternatively, you can change hosts
to a group of Ansible nodes or to all
. This will enable the bashrc for the user Ansible uses to connect to those nodes.
- hosts: localhost
tasks:
- name: "Include ckaserer.bashrc"
include_role:
name: "ckaserer.bashrc"
Systemwide Default
The playbook below will download the latest bashrc version for all nodes and enable it for every user.
You can also set hosts
to a group of Ansible nodes or to localhost
.
To run this systemwide version, you need root permissions, which is why there's an extra become: true
in the include_role
task.
- hosts: all
tasks:
- name: "Include ckaserer.bashrc"
include_role:
name: "ckaserer.bashrc"
apply:
become: true
vars:
systemwide: true
ansible-galaxy install ckaserer.bashrc