Enable templating for dotfiles
This commit is contained in:
6
_machines/notebook01.yml
Normal file
6
_machines/notebook01.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
font_size: 9
|
||||||
|
letter_space: 0
|
||||||
|
mail: hannes.koerber@haktec.de
|
||||||
|
git_gpg_sign: true
|
||||||
|
gpg_agent: true
|
||||||
|
ssh_agent: true
|
||||||
6
_machines/tb-hak.yml
Normal file
6
_machines/tb-hak.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
font_size: 10
|
||||||
|
letter_space: 0
|
||||||
|
mail: hannes.koerber@tradebyte.com
|
||||||
|
git_gpg_sign: false
|
||||||
|
gpg_agent: false
|
||||||
|
ssh_agent: false
|
||||||
16
dotfiles.yml
16
dotfiles.yml
@@ -1,16 +1,25 @@
|
|||||||
|
empty_directories:
|
||||||
|
- .i3
|
||||||
dotfiles:
|
dotfiles:
|
||||||
- from: autostart
|
- from: autostart
|
||||||
to: .autostart
|
to: .autostart
|
||||||
- from: git/gitconfig
|
- from: git/gitconfig
|
||||||
to: .gitconfig
|
to: .gitconfig
|
||||||
|
template: true
|
||||||
- from: gnupg/dirmngr.conf
|
- from: gnupg/dirmngr.conf
|
||||||
to: .gnupg/dirmngr.conf
|
to: .gnupg/dirmngr.conf
|
||||||
- from: gnupg/gpg-agent.conf
|
- from: gnupg/gpg-agent.conf
|
||||||
to: .gnupg/gpg-agent.conf
|
to: .gnupg/gpg-agent.conf
|
||||||
- from: gnupg/gpg.conf
|
- from: gnupg/gpg.conf
|
||||||
to: .gnupg/gpg.conf
|
to: .gnupg/gpg.conf
|
||||||
- from: i3
|
- from: i3/config
|
||||||
to: .i3
|
to: .i3/config
|
||||||
|
template: true
|
||||||
|
- from: i3/i3status.conf
|
||||||
|
to: .i3/i3status.conf
|
||||||
|
template: true
|
||||||
|
- from: i3/scripts
|
||||||
|
to: .i3/scripts
|
||||||
- from: tmux/tmux.conf
|
- from: tmux/tmux.conf
|
||||||
to: .tmux.conf
|
to: .tmux.conf
|
||||||
- from: vim/vimrc
|
- from: vim/vimrc
|
||||||
@@ -19,11 +28,14 @@ dotfiles:
|
|||||||
to: .vimrc
|
to: .vimrc
|
||||||
- from: x/Xresources
|
- from: x/Xresources
|
||||||
to: .Xresources
|
to: .Xresources
|
||||||
|
template: true
|
||||||
- from: x/xinitrc
|
- from: x/xinitrc
|
||||||
to: .xinitrc
|
to: .xinitrc
|
||||||
- from: zsh/zprofile
|
- from: zsh/zprofile
|
||||||
to: .zprofile
|
to: .zprofile
|
||||||
|
template: true
|
||||||
- from: zsh/zshrc
|
- from: zsh/zshrc
|
||||||
to: .zshrc
|
to: .zshrc
|
||||||
|
template: true
|
||||||
- from: zsh/zshrc.d
|
- from: zsh/zshrc.d
|
||||||
to: .zshrc.d
|
to: .zshrc.d
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[user]
|
[user]
|
||||||
name = Hannes Körber
|
name = Hannes Körber
|
||||||
email = hannes.koerber@haktec.de
|
email = {{ machine.mail }}
|
||||||
signingkey = 0x078A167A8741BD30
|
signingkey = 0x078A167A8741BD30
|
||||||
[github]
|
[github]
|
||||||
user = hakoerber
|
user = hakoerber
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
commitBeforeMerge = false
|
commitBeforeMerge = false
|
||||||
detachedHead = false
|
detachedHead = false
|
||||||
[commit]
|
[commit]
|
||||||
gpgSign = true
|
gpgSign = {{ machine.git_gpg_sign|bool }}
|
||||||
cleanup = strip
|
cleanup = strip
|
||||||
status = true
|
status = true
|
||||||
[status]
|
[status]
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
# The default terminal
|
# The default terminal
|
||||||
set $terminal "urxvt -title terminal"
|
set $terminal "urxvt -title terminal"
|
||||||
set $calc "urxvt256c -title term -e $SHELL -i -c calc"
|
set $calc "urxvt -title calc -e $SHELL -i -c calc"
|
||||||
|
|
||||||
set $scriptdir ~/.i3/scripts
|
set $scriptdir ~/.i3/scripts
|
||||||
|
|
||||||
@@ -279,7 +279,7 @@ assign [class="^Keepassx$"] $workspace8
|
|||||||
floating_minimum_size 0 x 0
|
floating_minimum_size 0 x 0
|
||||||
floating_maximum_size 0 x 0
|
floating_maximum_size 0 x 0
|
||||||
|
|
||||||
font pango:Inconsolata 10
|
font pango:Inconsolata {{ machine.font_size }}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
### COLOR SETTINGS #############################################################
|
### COLOR SETTINGS #############################################################
|
||||||
@@ -353,7 +353,7 @@ bar {
|
|||||||
|
|
||||||
id bar-0
|
id bar-0
|
||||||
|
|
||||||
font pango:Inconsolata, FontAwesome 10
|
font pango:Inconsolata, FontAwesome {{ machine.font_size }}
|
||||||
|
|
||||||
colors {
|
colors {
|
||||||
background #222222
|
background #222222
|
||||||
36
playbook.yml
36
playbook.yml
@@ -2,11 +2,22 @@
|
|||||||
connection: local
|
connection: local
|
||||||
become: false
|
become: false
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: read machine-specific variables
|
||||||
|
include_vars:
|
||||||
|
file: _machines/{{ ansible_hostname }}.yml
|
||||||
|
name: machine
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
distro: "{{ ansible_distribution|lower }}"
|
distro: "{{ ansible_distribution|lower }}"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
user: "{{ ansible_user_id }}"
|
user: "{{ ansible_user_id }}"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
- name: configure sudoers
|
- name: configure sudoers
|
||||||
lineinfile:
|
lineinfile:
|
||||||
@@ -153,6 +164,16 @@
|
|||||||
- name: load dotfile list
|
- name: load dotfile list
|
||||||
include_vars:
|
include_vars:
|
||||||
file: dotfiles.yml
|
file: dotfiles.yml
|
||||||
|
tags:
|
||||||
|
- dotfiles
|
||||||
|
|
||||||
|
- name: create empty directories for dotfiles
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: ~/{{ item }}
|
||||||
|
with_items: "{{ empty_directories }}"
|
||||||
|
tags:
|
||||||
|
- dotfiles
|
||||||
|
|
||||||
- name: link this folder to ~/.dotfiles
|
- name: link this folder to ~/.dotfiles
|
||||||
file:
|
file:
|
||||||
@@ -160,6 +181,8 @@
|
|||||||
force: true
|
force: true
|
||||||
path: "{{ ansible_user_dir }}/.dotfiles"
|
path: "{{ ansible_user_dir }}/.dotfiles"
|
||||||
src: "{{ playbook_dir }}"
|
src: "{{ playbook_dir }}"
|
||||||
|
tags:
|
||||||
|
- dotfiles
|
||||||
|
|
||||||
- name: link dotfiles
|
- name: link dotfiles
|
||||||
file:
|
file:
|
||||||
@@ -167,7 +190,20 @@
|
|||||||
force: true
|
force: true
|
||||||
path: "{{ ansible_user_dir }}/{{ item.to }}"
|
path: "{{ ansible_user_dir }}/{{ item.to }}"
|
||||||
src: ~/.dotfiles/{{ item.from }}
|
src: ~/.dotfiles/{{ item.from }}
|
||||||
|
when: not item.template|default(false)
|
||||||
with_items: "{{ dotfiles }}"
|
with_items: "{{ dotfiles }}"
|
||||||
|
tags:
|
||||||
|
- dotfiles
|
||||||
|
|
||||||
|
- name: deploy dotfiles templates
|
||||||
|
template:
|
||||||
|
src: ~/.dotfiles/{{ item.from }}.j2
|
||||||
|
dest: "{{ ansible_user_dir }}/{{ item.to }}"
|
||||||
|
force: true
|
||||||
|
when: item.template|default(false)
|
||||||
|
with_items: "{{ dotfiles }}"
|
||||||
|
tags:
|
||||||
|
- dotfiles
|
||||||
|
|
||||||
- name: create directories
|
- name: create directories
|
||||||
file:
|
file:
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ Xcursor.theme: Vanilla-DMZ
|
|||||||
|
|
||||||
URxvt.scrollBar: false
|
URxvt.scrollBar: false
|
||||||
|
|
||||||
URxvt.font: xft:Inconsolata:size=10
|
URxvt.font: xft:Inconsolata:size={{ machine.font_size }}
|
||||||
URxvt.letterSpace: -1
|
URxvt.letterSpace: {{ machine.letter_space }}
|
||||||
|
|
||||||
URxvt.perl-ext: default,matcher,selection-to-clipboard,font-size,resize-font
|
URxvt.perl-ext: default,matcher,selection-to-clipboard,font-size,resize-font
|
||||||
URxvt.url-launcher: /usr/bin/xdg-open
|
URxvt.url-launcher: /usr/bin/xdg-open
|
||||||
@@ -51,6 +51,12 @@ fi
|
|||||||
# because gpg-agent is somehow broken for ssh, use the usual ssh-agent
|
# because gpg-agent is somehow broken for ssh, use the usual ssh-agent
|
||||||
eval $(ssh-agent -s)
|
eval $(ssh-agent -s)
|
||||||
|
|
||||||
|
{% if distro == 'fedora' %}
|
||||||
|
alias urxvt=urxvt256c
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
alias vim="nvim"
|
||||||
|
|
||||||
# exec startx breaks some logind fuckery, without exec it works
|
# exec startx breaks some logind fuckery, without exec it works
|
||||||
if [[ -z $DISPLAY ]] ; then
|
if [[ -z $DISPLAY ]] ; then
|
||||||
if (( $XDG_VTNR == 1 )) ; then
|
if (( $XDG_VTNR == 1 )) ; then
|
||||||
@@ -2,12 +2,16 @@
|
|||||||
|
|
||||||
_zshdir="$HOME/.zshrc.d"
|
_zshdir="$HOME/.zshrc.d"
|
||||||
|
|
||||||
|
{% if machine.gpg_agent %}
|
||||||
export GPG_TTY=$(tty)
|
export GPG_TTY=$(tty)
|
||||||
gpg-connect-agent updatestartuptty /bye >/dev/null
|
gpg-connect-agent updatestartuptty /bye >/dev/null
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if machine.ssh_agent %}
|
||||||
if $(ssh-add -l 2>/dev/null | grep -q "no identities") ; then
|
if $(ssh-add -l 2>/dev/null | grep -q "no identities") ; then
|
||||||
ssh-add
|
ssh-add
|
||||||
fi
|
fi
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
for file in "${_zshdir}"/* ; do
|
for file in "${_zshdir}"/* ; do
|
||||||
if [[ -e "$file" ]] ; then
|
if [[ -e "$file" ]] ; then
|
||||||
Reference in New Issue
Block a user