From 06848fedcf80a253758e909eaafc1dc388d42135 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Thu, 28 Dec 2017 19:25:01 +0100 Subject: [PATCH] by_host and by_os dirs --- TODO | 1 - roles/compton/files/{.compton => compton} | 0 roles/compton/tasks/main.yml | 2 +- roles/i3-wm/README.md | 15 ++++++-- roles/i3-wm/files/{.xinitrc => xinitrc} | 0 roles/i3-wm/tasks/main.yml | 2 +- roles/i3-wm/templates/archlinux/config.j2 | 2 - .../templates/{ => by_host}/osz/config.j2 | 0 .../templates/{ => by_host}/work/config.j2 | 0 roles/i3-wm/templates/config.j2 | 5 +-- roles/polybar/README.md | 21 ++++++++--- roles/polybar/tasks/main.yml | 6 +-- .../templates/{ => by_host}/osz/launch.j2 | 0 .../{ => by_host}/osz/modules-bottom.j2 | 0 .../{ => by_host}/osz/modules-top.j2 | 0 .../templates/{ => by_host}/work/launch.j2 | 0 .../{ => by_host}/work/modules-bottom.j2 | 0 .../{ => by_host}/work/modules-def.j2 | 0 .../{ => by_host}/work/modules-top.j2 | 0 roles/polybar/templates/config.j2 | 9 +++-- roles/polybar/templates/launch.j2 | 2 +- roles/screen/files/{.screenrc => screenrc} | 0 roles/screen/tasks/main.yml | 2 +- roles/vim/tasks/main.yml | 2 +- roles/vim/templates/{.vimrc => vimrc} | 0 .../files/{.xbindkeysrc => xbindkeysrc} | 0 roles/xbindkeys/tasks/main.yml | 2 +- roles/zsh/README.md | 19 ++++++++++ roles/zsh/tasks/main.yml | 2 +- roles/zsh/templates/by_os/archlinux/zshrc.j2 | 4 ++ roles/zsh/templates/{.zshrc => zshrc.j2} | 37 +++++++++---------- 31 files changed, 86 insertions(+), 47 deletions(-) rename roles/compton/files/{.compton => compton} (100%) rename roles/i3-wm/files/{.xinitrc => xinitrc} (100%) delete mode 100644 roles/i3-wm/templates/archlinux/config.j2 rename roles/i3-wm/templates/{ => by_host}/osz/config.j2 (100%) rename roles/i3-wm/templates/{ => by_host}/work/config.j2 (100%) rename roles/polybar/templates/{ => by_host}/osz/launch.j2 (100%) rename roles/polybar/templates/{ => by_host}/osz/modules-bottom.j2 (100%) rename roles/polybar/templates/{ => by_host}/osz/modules-top.j2 (100%) rename roles/polybar/templates/{ => by_host}/work/launch.j2 (100%) rename roles/polybar/templates/{ => by_host}/work/modules-bottom.j2 (100%) rename roles/polybar/templates/{ => by_host}/work/modules-def.j2 (100%) rename roles/polybar/templates/{ => by_host}/work/modules-top.j2 (100%) rename roles/screen/files/{.screenrc => screenrc} (100%) rename roles/vim/templates/{.vimrc => vimrc} (100%) rename roles/xbindkeys/files/{.xbindkeysrc => xbindkeysrc} (100%) create mode 100644 roles/zsh/README.md create mode 100644 roles/zsh/templates/by_os/archlinux/zshrc.j2 rename roles/zsh/templates/{.zshrc => zshrc.j2} (74%) diff --git a/TODO b/TODO index df4f6d2..7d2df89 100644 --- a/TODO +++ b/TODO @@ -11,7 +11,6 @@ - vagrant: chsh in vagrant config file for FreeBSD - powerline: not working with centos|debian|freebsd -- zsh: clean zshrc template - playbook: add {{ tag }} to fail module to print in "limit to distrib" task - vagrant: tty in qwerty for debian keyboard diff --git a/roles/compton/files/.compton b/roles/compton/files/compton similarity index 100% rename from roles/compton/files/.compton rename to roles/compton/files/compton diff --git a/roles/compton/tasks/main.yml b/roles/compton/tasks/main.yml index ad3eb2d..796fb80 100644 --- a/roles/compton/tasks/main.yml +++ b/roles/compton/tasks/main.yml @@ -3,7 +3,7 @@ packer: name=compton-git state=present - name: Configure compton - copy: src=files/.compton dest=~/.compton backup=yes + copy: src=files/compton dest=~/.compton backup=yes - name: Init compton in .xprofile blockinfile: diff --git a/roles/i3-wm/README.md b/roles/i3-wm/README.md index 2454de4..a660638 100644 --- a/roles/i3-wm/README.md +++ b/roles/i3-wm/README.md @@ -2,9 +2,16 @@ - \~/.i3/config - \~/.xinitrc -# Hostname specific configuration for config file -Add a dir named as hostname to include specific host configuration in config file +# By hostname specific configuration in config file +Add a dir named as hostname in by_host dir to include specific host configuration in config file ``` -mkdir templates/$(hostname) -echo "#To include in config file" > templates/$(hostname)/config.j2 +mkdir templates/by_host/$(hostname) +echo "#To include in config file" > templates/by_host/$(hostname)/config.j2 +``` + +# By OS specific configuration for config file +Add a dir named as OS in by_os to include specific host configuration in config file +``` +mkdir templates/by_os/ +echo "#To include in config file" > templates/by_os//config.j2 ``` diff --git a/roles/i3-wm/files/.xinitrc b/roles/i3-wm/files/xinitrc similarity index 100% rename from roles/i3-wm/files/.xinitrc rename to roles/i3-wm/files/xinitrc diff --git a/roles/i3-wm/tasks/main.yml b/roles/i3-wm/tasks/main.yml index de1e601..aefe841 100644 --- a/roles/i3-wm/tasks/main.yml +++ b/roles/i3-wm/tasks/main.yml @@ -26,7 +26,7 @@ ignore_errors: True - name: Configure xinitrc - copy: src=files/.xinitrc dest=~/.xinitrc backup=yes + copy: src=files/xinitrc dest=~/.xinitrc backup=yes - name: Template config file template: src=templates/config.j2 dest=~/.i3/config backup=yes diff --git a/roles/i3-wm/templates/archlinux/config.j2 b/roles/i3-wm/templates/archlinux/config.j2 deleted file mode 100644 index d7776e0..0000000 --- a/roles/i3-wm/templates/archlinux/config.j2 +++ /dev/null @@ -1,2 +0,0 @@ -# Vagrant template -# test test diff --git a/roles/i3-wm/templates/osz/config.j2 b/roles/i3-wm/templates/by_host/osz/config.j2 similarity index 100% rename from roles/i3-wm/templates/osz/config.j2 rename to roles/i3-wm/templates/by_host/osz/config.j2 diff --git a/roles/i3-wm/templates/work/config.j2 b/roles/i3-wm/templates/by_host/work/config.j2 similarity index 100% rename from roles/i3-wm/templates/work/config.j2 rename to roles/i3-wm/templates/by_host/work/config.j2 diff --git a/roles/i3-wm/templates/config.j2 b/roles/i3-wm/templates/config.j2 index d3a77c5..00f00c6 100644 --- a/roles/i3-wm/templates/config.j2 +++ b/roles/i3-wm/templates/config.j2 @@ -153,10 +153,9 @@ bindsym $mod+Shift+underscore move container to workspace $tag8 bindsym $mod+Shift+ccedilla move container to workspace $tag9 bindsym $mod+Shift+agrave move container to workspace $tag10 -### BEGIN includes -{% include ansible_hostname + '/config.j2' ignore missing %} +{% include 'by_host/' + ansible_hostname + '/config.j2' ignore missing %} -### END includes +{% include 'by_os/' + ansible_distribution|lower + '/config.j2' ignore missing %} # reload the configuration file bindsym $mod+Shift+c reload diff --git a/roles/polybar/README.md b/roles/polybar/README.md index fa89612..0c29b3e 100644 --- a/roles/polybar/README.md +++ b/roles/polybar/README.md @@ -16,9 +16,9 @@ EOF It will uncomment monitor values in config.j2 too -# Modules configuration +# Modules configuration by host ``` -mkdir templates/$(hostname) +mkdir templates/by_host/$(hostname) # Top modules configuration echo <<\EOF > templates/$(hostname)/modules-top.j2 modules-left = i3 xwindow @@ -27,21 +27,32 @@ modules-right = backlight volume pkg wlan vpncheck battery date EOF # Bottom modules configuration -echo <<\EOF > templates/$(hostname)/modules-bottom.j2 +echo <<\EOF > templates/by_host/$(hostname)/modules-bottom.j2 modules-left = modules-center = networkspeedup networkspeeddown modules-right = temperature filesystem-slash filesystem-home cpu memory EOF +``` -# Include some modules -echo <<\EOF > templates/$(hostname)/modules-def.j2 +# Modules definition + +## By host + +``` +echo <<\EOF > templates/by_host/$(hostname)/modules-def.j2 [module/example] type = custom/script interval = 1200 format =