aboutsummaryrefslogtreecommitdiffstats
path: root/roles/users
diff options
context:
space:
mode:
authorEmil Renner Berthing <esmil@labitat.dk>2018-09-30 21:25:28 +0200
committerEmil Renner Berthing <esmil@labitat.dk>2018-09-30 21:30:53 +0200
commita39fb817e87d053f82e06305b4a737d40c483ee3 (patch)
tree595e7297f2f7a565e3e5786255e17d4815eab486 /roles/users
parenta34e4d1dfe1b6990824051fde40e9288c8cdfd5d (diff)
downloadlabitat-ansible-a39fb817e87d053f82e06305b4a737d40c483ee3.tar.gz
labitat-ansible-a39fb817e87d053f82e06305b4a737d40c483ee3.tar.xz
labitat-ansible-a39fb817e87d053f82e06305b4a737d40c483ee3.zip
users: root: let each user have their own root bashrc
Diffstat (limited to 'roles/users')
-rw-r--r--roles/users/files/root/bash_profile5
-rw-r--r--roles/users/files/root/bash_profile.sh1
-rw-r--r--roles/users/files/root/bashrc4
-rw-r--r--roles/users/tasks/root.yml17
-rw-r--r--roles/users/templates/root/bashrc.sh.j234
5 files changed, 15 insertions, 46 deletions
diff --git a/roles/users/files/root/bash_profile b/roles/users/files/root/bash_profile
new file mode 100644
index 0000000..457213b
--- /dev/null
+++ b/roles/users/files/root/bash_profile
@@ -0,0 +1,5 @@
+if [[ -n "$SUDO_USER" && -f "/home/$SUDO_USER/.bashrc_root" ]]; then
+ . "/home/$SUDO_USER/.bashrc_root"
+else
+ . "$HOME/.bashrc"
+fi
diff --git a/roles/users/files/root/bash_profile.sh b/roles/users/files/root/bash_profile.sh
deleted file mode 100644
index 3ee6b29..0000000
--- a/roles/users/files/root/bash_profile.sh
+++ /dev/null
@@ -1 +0,0 @@
-. "$HOME/.bashrc"
diff --git a/roles/users/files/root/bashrc b/roles/users/files/root/bashrc
new file mode 100644
index 0000000..f380bc8
--- /dev/null
+++ b/roles/users/files/root/bashrc
@@ -0,0 +1,4 @@
+# if not running interactively, don't do anything
+[[ $- != *i* ]] && return
+
+stty -ixon
diff --git a/roles/users/tasks/root.yml b/roles/users/tasks/root.yml
index e5b3b45..8ac84e7 100644
--- a/roles/users/tasks/root.yml
+++ b/roles/users/tasks/root.yml
@@ -1,18 +1,13 @@
---
-- name: root .bash_profile
+- name: root - dotfiles
copy:
- dest: '/root/.bash_profile'
- src: root/bash_profile.sh
- owner: root
- group: root
- mode: 0644
-
-- name: root .bashrc
- template:
- dest: '/root/.bashrc'
- src: root/bashrc.sh.j2
+ dest: '~root/.{{ item }}'
+ src: 'root/{{ item }}'
owner: root
group: root
mode: 0644
+ with_items:
+ - bash_profile
+ - bashrc
# vim: set ts=2 sw=2 et:
diff --git a/roles/users/templates/root/bashrc.sh.j2 b/roles/users/templates/root/bashrc.sh.j2
deleted file mode 100644
index bcc4ddb..0000000
--- a/roles/users/templates/root/bashrc.sh.j2
+++ /dev/null
@@ -1,34 +0,0 @@
-# if not running interactively, don't do anything
-[[ $- != *i* ]] && return
-
-export PS1='\[\e[1;31m\]\u\[\e[00m\]@\[\e[0;31m\]\h\[\e[1;34m\]\w\[\e[00m\]\$ '
-unset PROMPT_COMMAND
-
-# directory listing
-eval "$(dircolors -b)"
-alias ls='ls --color=auto -F'
-alias ll='ls -Ahl'
-
-# some more alias to avoid making mistakes:
-alias rm='rm -ri'
-alias cp='cp -rid'
-alias mv='mv -i'
-
-# editor
-export EDITOR='vim'
-alias vi='vim'
-
-# network
-alias ip6='ip -6'
-{% if ansible_service_mgr == 'systemd' %}
-
-# systemd
-alias start='systemctl start'
-alias stop='systemctl stop'
-alias restart='systemctl restart'
-alias status='systemctl status'
-alias cgls='systemd-cgls'
-alias cgtop='systemd-cgtop'
-{% endif %}
-
-cd