Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

ansible-playbook install.yml --extra-vars "lsb_release=$(lsb_release -cs)" --ask-become-pass
ansible-playbook install.yml --extra-vars "lsb_release=$(lsb_release -cs)" --ask-become-pass -i "localhost," -c local
5 changes: 2 additions & 3 deletions install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

- hosts: localhost
roles:
- common
#- common
- back
- front
vars_files:
- vars.yml
- vars.yml
23 changes: 23 additions & 0 deletions roles/back/tasks/install_jdk_maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: Create /home/{{ ansible_user }}/tmp directory
ansible.builtin.file:
path: /home/{{ ansible_user }}/tmp
state: directory
mode: '0755'

- name: Download SDKMAN
get_url:
url: https://get.sdkman.io
dest: '/home/{{ ansible_user }}/tmp/sdkman_script'
owner: '{{ ansible_user }}'
group: '{{ ansible_user }}'
validate_certs: true
become: yes

- name: Run sdkman script if /home/{{ ansible_user }}/.sdkman/bin/sdkman-init.sh does not exist
ansible.builtin.command: /bin/bash /home/{{ ansible_user }}/tmp/sdkman_script
args:
creates: /home/{{ ansible_user }}/.sdkman/bin/sdkman-init.sh
become: yes

- name: Source sdkman
ansible.builtin.command: /bin/bash /home/{{ ansible_user }}/.sdkman/bin/sdkman-init.sh
14 changes: 2 additions & 12 deletions roles/back/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@

- name: Build home
import_tasks: home_building.yml

- name: Install java
import_tasks: install_java.yml

- name: Install gradle
import_tasks: install_gradle.yml

- name: Install maven
import_tasks: install_maven.yml
- name: Install JDKs, maven
import_tasks: install_jdk_maven.yml
1 change: 0 additions & 1 deletion roles/back/templates/.back_bash_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ alias setjava7='export JAVA_HOME=/usr/lib/jvm/java-7-oracle'
alias setjava8='export JAVA_HOME=/usr/lib/jvm/java-8-oracle'

# maven
alias mvn='~/applications/maven/bin/mvn'
alias mci='mvn clean install'
alias mcis='mvn clean install -DskipTests'
alias mct='mvn clean test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,26 @@
with_items:
- build-essential
- tmux
- curl
- httpie
- jq
- git-flow
- docker-ce
- zip
- unzip
- vim-gtk
- vim
- silversearcher-ag
become: yes

- name: Allow docker for non root
command: groupadd -f docker
become: yes
- user: name={{ansible_user}} groups=docker append=yes
- user: name={{ ansible_user }} groups=docker append=yes
become: yes

- name: Install docker-compose
get_url:
url: https://github.com/docker/compose/releases/download/{{ dc_version }}/docker-compose-{{ ansible_system }}-{{ ansible_userspace_architecture }}
dest: /usr/local/bin/docker-compose
mode: 0755

- name: Install docker compose plugin
apt:
name: docker-compose-plugin
install_recommends: yes
become: yes

# Tmux
- name: Install tmux plugin manager
file: path=~/.tmux/plugins/tpm state=directory
- git:
repo: https://github.com/tmux-plugins/tpm
dest: ~/.tmux/plugins/tpm
update: no
2 changes: 1 addition & 1 deletion roles/common/tasks/home_building.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- template: src=templates/.tmux.conf dest=~/.tmux.conf
- template: src=templates/.bashrc dest=~/.bashrc mode=0755
- template: src=templates/.bash_aliases dest=~/.bash_aliases mode=0755
- template: src=templates/.ssh/config dest=~/.ssh/config
#- template: src=templates/.ssh/config dest=~/.ssh/config
- template: src=templates/git-repos-checkout-all.sh dest=~/bin/git-repos-checkout-all.sh mode=0755

- git:
Expand Down
9 changes: 4 additions & 5 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

- name: Build home
- name: Home building
import_tasks: home_building.yml

- name: Install minimal tools
import_tasks: minimal_tools.yml
when: ansible_os_family == "Debian"
- name: Install core tools (curl, jq, docker, docker compose)
import_tasks: core_tools.yml
when: ansible_os_family == "Debian"
2 changes: 0 additions & 2 deletions roles/common/templates/.bash_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ alias alais='alias'
alias gitrepos_update_all='~/bin/git-repos-update-all.sh'
alias gitrepos_checkout_all='~/bin/git-repos-checkout-all.sh'

alias ack='ack-grep'

alias gitbranchpurge='git fetch -p && git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | xargs -n 1 git branch -d'

alias gsubs='git pull && git submodule sync --recursive && git submodule update --init --recursive --jobs 8'
Expand Down
120 changes: 76 additions & 44 deletions roles/common/templates/.bashrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#{{ ansible_managed }}
if [ -n "$SSH_CLIENT" ]; then
PS1="Via ssh: "
Expand All @@ -10,41 +9,30 @@ case $- in
*) return;;
esac

. /etc/bash.bashrc

# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# 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=10000
HISTFILESIZE=100000
export HISTTIMEFORMAT="%F %T"
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# Fix minor errors in directory name when cd'ing
shopt -s cdspell

# Automatically enter a directory even when command is not prefixed with 'cd'
shopt -s autocd

# When on, single tab is necessary instead of two to display the list of completions
bind 'set show-all-if-ambiguous on'

# Disable suspend/resume process, aka flow control with ctrl+s/ctrl+q
stty -ixon
# 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
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

Expand All @@ -54,57 +42,101 @@ function display_profile {

source ~/.bash-git-prompt/gitprompt.sh


# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) 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

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -l'
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$//'\'')"'

# enable ANSI color
export LESS="-r"
# 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 [ -f /etc/bash_completion ] && ! shopt -oq posix; then
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

[ -f ~/.fzf.bash ] && source ~/.fzf.bash

export TERM=xterm-256color
export GDK_NATIVE_WINDOWS=1
export JAVA_HOME=~/applications/jdk
export GRADLE_HOME=~/applications/gradle
export MAVEN_HOME=~/applications/maven
export CHROME_BIN=/usr/bin/chromium
export PATH=$PATH:$GRADLE_HOME/bin:$MAVEN_HOME/bin:$JAVA_HOME/bin
export TZ='Europe/Paris'
export LANG='en_US.UTF-8'
export LANGUAGE='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'

if [ -f .environment ]; then
source .environment
fi

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
#export LC_ALL='en_US.UTF-8'

if [ -f ~/.back_bash_aliases ]; then
. ~/.back_bash_aliases
fi

if [ -f ~/.maven_bash_completion.bash ]; then
. ~/.maven_bash_completion.bash
fi

export FZF_DEFAULT_COMMAND='ag -g ""'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"

Expand All @@ -120,4 +152,4 @@ function tmux {
fi
}

#{{ ansible_managed }}
#{{ ansible_managed }}
2 changes: 1 addition & 1 deletion roles/common/templates/.tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -g history-limit 100000
set -g status-right "#(docker ps -a -f id=`hostname` --format \"{{'{{.Names}}'}}\") #[bold]%d-%m-%Y#[nobold] %H:%M "
set -g status-fg white
set -g status-bg colour238
setw -g window-status-current-bg blue
setw -g window-status-current-style bg=blue

# number windows starting from 1 - handy for direct access
set -g base-index 1
Expand Down
22 changes: 0 additions & 22 deletions roles/front/tasks/install_node.yml

This file was deleted.

21 changes: 0 additions & 21 deletions roles/front/tasks/install_yarn.yml

This file was deleted.

6 changes: 0 additions & 6 deletions roles/front/tasks/main.yml

This file was deleted.

Loading