diff --git a/.gitignore b/.gitignore index e69de29..110be62 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +debug.yml diff --git a/ansible.cfg b/ansible.cfg index 5ebf4d4..009196a 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -4,7 +4,8 @@ timeout = 60 # ask_vault_pass = True [privilege_escalation] -# become_ask_pass = True +become = True +become_ask_pass = True [ssh_connection] pipelining = True diff --git a/group_vars/all.yml b/group_vars/all.yml index d37cca2..21784ef 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -1,4 +1,23 @@ --- +# Custom header +dirty: "{% if template_path is defined %}{{ lookup('pipe', 'git diff --quiet -- ' + template_path | quote + ' || echo dirty') }}{% else %}{{ lookup('pipe', 'git diff --quiet || echo dirty') }}{% endif %}" +ansible_header: | + +++++++++++++++++++++++++++++++++++++++++++++++++++ + + Ansible managed, don't modify the file locally. + See https://gitlab.crans.org/nounous/ansible. + {% if template_path is defined %}{% set _, rpath = template_path.split('roles/', 1) %}Commit: {% if dirty %}({{dirty}}) {% endif %}{{ lookup('pipe', 'git log -n 1 --pretty=format:%H -- ' + template_path | quote) }} + {% if dirty %}Run by: {{ ansible_env.SUDO_USER }} + {% else %}Author: {{ lookup('pipe', 'git log -n 1 --pretty=format:%an -- ' + template_path | quote) }} + {% endif %}Template: roles/{{ rpath }} + {% else %} + Run by: {{ ansible_env.SUDO_USER }} + Latest commit: {% if dirty %}({{dirty}}) {% endif %}{{ lookup('pipe', 'git rev-parse HEAD') }} + {% endif %} + + +++++++++++++++++++++++++++++++++++++++++++++++++++ + + pass: upstream: 'ssh://git@git.ynerant.fr:2222/ynerant/pass' @@ -9,7 +28,7 @@ cliutils: bogus_dirs: [] git: email: ynerant@crans.org - name: ynerant + name: Yohann D'ANELLO signingkey: 3A75C55819C8CF85 bind: @@ -18,5 +37,17 @@ bind: administrator: ynerant.crans.org ipv4: 185.230.78.178 ipv6: 2a0c:700:12:0:f21f:afff:fee5:34ca - slave: 51.15.199.212 - aliases: [] + slave: "" # 51.15.199.212 + aliases: + - cloud + - element + - git + - hydrogen + - mailu + - notls + - synapse + - thelounge + - traefik + - translate + - whoami + - www diff --git a/roles/cli-utils/templates/bash_aliases.j2 b/roles/cli-utils/templates/bash_aliases.j2 index c10ad12..9496177 100644 --- a/roles/cli-utils/templates/bash_aliases.j2 +++ b/roles/cli-utils/templates/bash_aliases.j2 @@ -1,5 +1,7 @@ #!/bin/bash +{{ ansible_header | comment }} + # 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)" diff --git a/roles/cli-utils/templates/bashrc.j2 b/roles/cli-utils/templates/bashrc.j2 index 029c81d..f615511 100644 --- a/roles/cli-utils/templates/bashrc.j2 +++ b/roles/cli-utils/templates/bashrc.j2 @@ -1,3 +1,5 @@ +{{ ansible_header | comment }} + [ -z "$PS1" ] && return HISTCONTROL=ignoredups:ignorespace diff --git a/roles/cli-utils/templates/gitconfig.j2 b/roles/cli-utils/templates/gitconfig.j2 index 4892b98..44b3d62 100644 --- a/roles/cli-utils/templates/gitconfig.j2 +++ b/roles/cli-utils/templates/gitconfig.j2 @@ -1,3 +1,5 @@ +{{ ansible_header | comment }} + [user] email = {{ cliutils.git.email }} name = {{ cliutils.git.name }} diff --git a/roles/cli-utils/templates/inputrc.j2 b/roles/cli-utils/templates/inputrc.j2 index cb7528e..d297db7 100644 --- a/roles/cli-utils/templates/inputrc.j2 +++ b/roles/cli-utils/templates/inputrc.j2 @@ -1 +1,3 @@ +{{ ansible_header | comment }} + set mark-symlinked-directories on diff --git a/roles/cli-utils/templates/tmux.conf.j2 b/roles/cli-utils/templates/tmux.conf.j2 index b86803d..f55c71d 100644 --- a/roles/cli-utils/templates/tmux.conf.j2 +++ b/roles/cli-utils/templates/tmux.conf.j2 @@ -1,8 +1,17 @@ +{{ ansible_header | comment }} + unbind r bind r source-file ~/.tmux.conf set -g mouse on +## set the default TERM +set -g default-terminal screen + +## update the TERM variable of terminal emulator when creating a new session or attaching a existing session +set -g update-environment 'DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY TERM' +## determine if we should enable 256-colour support +if "[[ ${TERM} =~ 256color || ${TERM} == fbterm ]]" 'set -g default-terminal screen-256color' # use the vim motion keys to move between panes bind h select-pane -L