diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index ddc751dbbc..8527f1e32d 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -452,3 +452,15 @@ - service - watchdog - base + +# +#Set PS1 to show prod/stage environment at PS1 +#Should work in sh/bash. Needs tested in other shells +# +- name: set PS1 for prod and stage in /etc/profile.d + copy: src=setps1.sh.j2 dest=/etc/profile.d/setps1.sh + when: {{ env in ['production','staging'] }} + tags: + - base + - config + diff --git a/roles/base/templates/setps1.sh.j2 b/roles/base/templates/setps1.sh.j2 new file mode 100644 index 0000000000..6eca2dcb38 --- /dev/null +++ b/roles/base/templates/setps1.sh.j2 @@ -0,0 +1,8 @@ +# Set PS1 based on env: +# +{% if {{ env }} in 'production' %} +PS1="\e[0;31m[PROD]\e[m[\u@\h \W]\$ " +{% elif {{ env }} in 'staging' %} +PS1="[STG]\e[m[\u@\h \W]\$ " +{% endif }% +