Commit d7a07abd authored by Stefan Galinski's avatar Stefan Galinski 🎮
Browse files

[TASK] Initial commit

parents
default['ubuntu_base']['locales'] = %w(en_GB.utf8 de_DE.utf8)
\ No newline at end of file
name 'ubuntu_base'
maintainer 'sgalinski Internet Services'
maintainer_email 'stefan@sgalinski.de'
license 'Apache 2.0'
description 'Basic setup'
long_description 'Basic setup'
version '1.0.0'
recipe 'ubuntu_base::default', 'Provides the basic configuration and setup'
depends 'apt'
depends 'build-essential'
depends 'git'
depends 'rsync'
depends 'locales'
depends 'ssh_known_hosts'
depends 'vim'
\ No newline at end of file
#
# Cookbook Name:: ubuntu_base
# Recipe:: default
#
# Copyright sgalinski Internet Services
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
data_bag = data_bag_item('apps', 'global')
####################################
### Add some additional packages ###
####################################
include_recipe 'apt'
include_recipe 'vim'
include_recipe 'build-essential'
include_recipe 'git'
include_recipe 'rsync'
include_recipe 'locales'
include_recipe 'ssh_known_hosts'
#########################
### Update the system ###
#########################
# apt-get crashes if the directory isn't created before it's execution
# can be removed maybe later on
directory '/var/www/html' do
recursive true
action :create
end
execute 'apt-get -y upgrade'
#################################################
### Fix the user/group id of the vagrant user ###
#################################################
bash 'changeUserId' do
cwd '/home/vagrant/'
code <<-EOF
cat /etc/group | sed s'/vagrant:x:1000/vagrant:x:#{data_bag['groupId']}/' > /home/vagrant/group.bak
mv /home/vagrant/group.bak /etc/group
cat /etc/passwd | sed s'/vagrant:x:1000:1000/vagrant:x:#{data_bag['userId']}:#{data_bag['groupId']}/' > /home/vagrant/passwd.bak
mv /home/vagrant/passwd.bak /etc/passwd
chown -R vagrant:vagrant /home/vagrant
EOF
action :run
end
##########################################################
### Install cachefilesd to improve the NFS performance ###
##########################################################
package 'cachefilesd' do
action :install
end
file '/etc/default/cachefilesd' do
content <<-EOf
RUN=yes
EOf
action :create
mode 0755
end
##########################################
### Provide common configuration files ###
##########################################
template '/home/vagrant/.bashrc' do
source 'bashrc'
owner 'vagrant'
group 'vagrant'
end
template '/home/vagrant/.vimrc' do
source 'vimrc'
owner 'vagrant'
group 'vagrant'
end
template '/home/vagrant/.vimrc.less' do
source 'vimrc_less'
owner 'vagrant'
group 'vagrant'
end
template '/home/vagrant/.gitconfig' do
source 'gitconfig.erb'
owner 'vagrant'
group 'vagrant'
variables(
{
:author => data_bag['name'],
:authorEmail => data_bag['email']
}
)
end
#######################################################
### Add ssh wrapper scripts for git and other tools ###
#######################################################
file '/home/vagrant/ssh_wrapper.sh' do
owner 'vagrant'
group 'vagrant'
mode '0755'
content "#!/bin/sh\nexec /usr/bin/ssh -o \"StrictHostKeyChecking=no\" -i /home/vagrant/.ssh/id_rsa \"$@\""
end
###################
### Add locales ###
###################
locales 'Add locales' do
locales node['ubuntu_base']['locales']
end
\ No newline at end of file
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
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'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
export EDITOR=vim
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# vless - colored less
alias vless="vim -u ~/.vimrc.less -"
\ No newline at end of file
[alias] tree = log --graph --decorate --pretty=oneline --abbrev-commit
[user]
name = <%= @author %>
email = <%= @authorEmail %>
[color]
ui = true
diff = auto
status = auto
branch = auto
interactive = auto
[pager]
status = yes
[branch]
autosetuprebase = remote
[push]
default = matching
\ No newline at end of file
autocmd FileType php setlocal noeol binary
set tabstop=4
set background=dark
syntax enable
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
" set mouse=a " Enable mouse usage (all modes)
\ No newline at end of file
" No compatibility – necessary for mappings to work.
set nocompatible
" Status line
set laststatus=0
set cmdheight=1
set nomodifiable " Only in version 6.0
set readonly
" My xterms have a navy-blue background, so I need this line too.
set background=dark
" Turn syntax on
syntax enable
" No menu bar and tool bar
set guioptions=aiMr
" Key bindings.
nmap b <C-B><C-G>
nmap q :q!<CR>
nmap <Up> <C-Y>
nmap <Down> <C-E>
" To type the following line, type *two* C-V's followed by two spaces. This
" is how you map the spacebar.
nmap ^V <C-F><C-G>
\ No newline at end of file
Supports Markdown
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