Commit e2c696a7 authored by Matthew Smith's avatar Matthew Smith
Browse files

Initial commit

parents
---
bash_vi_mode: false
bash_aliases:
- { name: grep, value: 'grep --color' }
- { name: ls, value: 'ls --color' }
- { name: ll, value: 'ls -l' }
- { name: la, value: 'ls -la' }
- { name: ltr, value: 'ls -ltr' }
---
# contents of /etc/skel/ are copied to user on useradd
- name: get all bashrc files
find:
paths: [ "/etc/skel/", "/root/", "/home/sol1/" ]
patterns: '.bashrc'
recurse: yes
hidden: yes
register: bashrc
- name: make sure force_color_prompt is on
replace:
path: "{{ item.path }}"
regexp: '#force_color_prompt=yes'
replace: 'force_color_prompt=yes'
with_items: "{{ bashrc.files }}"
- name: make sure PS1 matches
lineinfile:
path: "{{ item.path }}"
regexp: '^[# ]*PS1=.*'
line: 'PS1="${debian_chroot:+($debian_chroot)}\[\e[01;32m\]\u@\h\[\e[m\]:\[\e[01;36m\]\w\[\e[m\]# "'
# insertafter: "# bash PS1 added by Ansible role bashrc"
with_items: "{{ bashrc.files }}"
- name: change the colour for root
replace:
path: "{{ item.path }}"
regexp: '01;32m'
replace: '01;31m'
with_items: "{{ bashrc.files }}"
when: item.path == '/root/.bashrc'
- name: aliases heading
lineinfile:
path: "{{ item.path }}"
line: "# bash aliases added by Ansible role bashrc"
state: present
with_items: "{{ bashrc.files }}"
- name: Create bash aliases
lineinfile:
path: "{{ item.0.path }}"
regexp: "alias {{ item.1.name }}="
line: "alias {{ item.1.name }}='{{ item.1.value }}'"
insertafter: "# bash aliases added by Ansible role bashrc"
with_nested:
- "{{ bashrc.files }}"
- "{{ bash_aliases }}"
- name: vi mode heading
lineinfile:
path: "{{ item.path }}"
line: "# bash vi mode added by Ansible role bashrc"
state: present
with_items: "{{ bashrc.files }}"
when: bash_vi_mode == true
- name: vi mode on
lineinfile:
path: "{{ item.path }}"
line: 'set -o vi'
insertafter: "# bash vi mode added by Ansible role bashrc"
state: present
with_items: "{{ bashrc.files }}"
when: bash_vi_mode == true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment