Add support for .profile filetags/v0.45.0
@@ -34,10 +34,15 @@ is configured. | |||
Ensures the bashrc file exists in the users home directory. Set manage_bashrc: | |||
True in pillar per user. Defaults to False | |||
``users.profile`` | |||
---------------- | |||
Ensures the profile file exists in the users home directory. Set manage_profile: | |||
True in pillar per user. Defaults to False | |||
``users.vimrc`` | |||
--------------- | |||
Ensures the vimrc file exists in the users home directory. Set manage_vimrc: | |||
True in pillar per user. Defaults to False | |||
This depends on the vim-formula to be installed | |||
@@ -12,6 +12,7 @@ users: | |||
createhome: True | |||
manage_vimrc: False | |||
manage_bashrc: False | |||
manage_profile: False | |||
expire: 16426 | |||
sudouser: True | |||
# sudo_rules doesn't need the username as a prefix for the rule |
@@ -0,0 +1,22 @@ | |||
# ~/.profile: executed by the command interpreter for login shells. | |||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login | |||
# exists. | |||
# see /usr/share/doc/bash/examples/startup-files for examples. | |||
# the files are located in the bash-doc package. | |||
# the default umask is set in /etc/profile; for setting the umask | |||
# for ssh logins, install and configure the libpam-umask package. | |||
#umask 022 | |||
# if running bash | |||
if [ -n "$BASH_VERSION" ]; then | |||
# include .bashrc if it exists | |||
if [ -f "$HOME/.bashrc" ]; then | |||
. "$HOME/.bashrc" | |||
fi | |||
fi | |||
# set PATH so it includes user's private bin if it exists | |||
if [ -d "$HOME/bin" ] ; then | |||
PATH="$HOME/bin:$PATH" | |||
fi |
@@ -0,0 +1,27 @@ | |||
{% from "users/map.jinja" import users with context %} | |||
include: | |||
- users | |||
{% for name, user in pillar.get('users', {}).items() if user.absent is not defined or not user.absent %} | |||
{%- if user == None -%} | |||
{%- set user = {} -%} | |||
{%- endif -%} | |||
{%- set home = user.get('home', "/home/%s" % name) -%} | |||
{%- set manage = user.get('manage_profile', False) -%} | |||
{%- if 'prime_group' in user and 'name' in user['prime_group'] %} | |||
{%- set user_group = user.prime_group.name -%} | |||
{%- else -%} | |||
{%- set user_group = name -%} | |||
{%- endif %} | |||
{%- if manage -%} | |||
users_{{ name }}_user_profile: | |||
file.managed: | |||
- name: {{ home }}/.profile | |||
- user: {{ name }} | |||
- group: {{ user_group }} | |||
- mode: 644 | |||
- source: | |||
- salt://users/files/profile/{{ name }}/profile | |||
- salt://users/files/profile/profile | |||
{% endif %} | |||
{% endfor %} |