Commit d4f78ef6 by John Jarvis

bashrc changes

parent 50abf52c
# Creates a single user on a server
# By default no super-user privileges
# By default no super-user privileges
# Example: ansible-playbook -i "jarv.m.sandbox.edx.org," ./create_user.yml -e "user=jarv"
# Create a user with sudo privileges
# Create a user with sudo privileges
# Example: ansible-playbook -i "jarv.m.sandbox.edx.org," ./create_user.yml -e "user=jarv" -e "give_sudo=true"
- name: Create a single user
hosts: all
sudo: True
gather_facts: False
vars:
give_sudo: False
pre_tasks:
- fail: msg="You must pass a user into this play"
when: not user
when: user is not defined
- name: give access with no sudo
set_fact:
gh_users_no_sudo:
- "{{ user }}"
when: not give_sudo or give_sudo == "false"
user_info:
- name: "{{ user }}"
github: true
when: give_sudo is not defined
- name: give access with sudo
set_fact:
gh_users:
- "{{ user }}"
when: give_sudo
user_info:
- name: "{{ user }}"
admin: true
github: true
when: give_sudo is defined
roles:
- gh_users
- user
......@@ -60,6 +60,8 @@
- fail: you must pass in a user_info parameter to this role
when: user_info|length == 0
- debug: var=user_info
- name: create the edxadmin group
group: name=edxadmin state=present
......@@ -106,7 +108,7 @@
owner={{ item.name }}
mode=0440 validate='visudo -cf %s'
when: item.authorized_keys is defined
with_item: user_info
with_items: user_info
- name: create bashrc file for normal users
template: >
......@@ -121,6 +123,7 @@
src=default.profile.j2
dest=/home/{{ item.name }}/.profile mode=0640
owner={{ item.name }}
with_items: user_info
########################################################
# All tasks below this line are for restricted users
......
......@@ -54,9 +54,9 @@ if [ -n "$force_color_prompt" ]; then
fi
if [ "$color_prompt" = yes ]; then
PS1='{{ GH_USERS_PROMPT }}${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PS1='{{ USER_CMD_PROMPT }}${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='{{ GH_USERS_PROMPT}}${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
PS1='{{ USER_CMD_PROMPT}}${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
......@@ -73,9 +73,6 @@ esac
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
......@@ -85,6 +82,7 @@ fi
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias h='ls ~/.bash_histories/*/* | sort | xargs grep -i '
# better bash history
......
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