From f7de63a07a93f19b45b7b659f2b55f8207df695c Mon Sep 17 00:00:00 2001
From: Lars Beckers <lars.beckers@rwth-aachen.de>
Date: Fri, 13 Apr 2018 20:51:30 +0200
Subject: [PATCH] shell: new grml-zsh-config deployment

---
 .gitignore            |  1 +
 shell/tasks/shell.yml | 57 ++++++++++++++++++++++++++++++++-----------
 2 files changed, 44 insertions(+), 14 deletions(-)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..468cd87
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.pkg.tar.xz
diff --git a/shell/tasks/shell.yml b/shell/tasks/shell.yml
index 475c4a9..6190e3d 100644
--- a/shell/tasks/shell.yml
+++ b/shell/tasks/shell.yml
@@ -2,7 +2,10 @@
 # file: roles/common/tasks/shell.yml
 
 - name: ensure installation of basic shell commands
-  apt: state=latest name={{ item }} install_recommends=no
+  apt:
+    name: "{{ item }}"
+    state: installed
+    install_recommends: no
   with_items:
     - git
     - vim
@@ -13,7 +16,9 @@
     - shell
 
 - name: ensure installaton of some additional software
-  apt: state=latest name={{ item }}
+  apt:
+    name: "{{ item }}"
+    state: installed
   with_items:
     - aptitude
     - atop
@@ -51,39 +56,63 @@
     - packages
     - shell
 
-- name: ensure zsh-grml is available
-  get_url: url=http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc dest={{ item }} owner=root group=root mode=0644
-  with_items:
-    - /etc/zsh/zshrc
-    - /root/.zshrc
+- name: ensure we have an up-to-date version of grml-zsh-config
+  get_url:
+    url: https://www.archlinux.org/packages/extra/any/grml-zsh-config/download/
+    dest: "{{ role_path }}/files/"
+  delegate_to: localhost
+  run_once: True
+  register: grml_zsh
   tags:
     - config
     - shell
 
-- name: ensure zsh-grml is the default
-  get_url: url=http://git.grml.org/f/grml-etc-core/etc/skel/.zshrc dest={{ item }} owner=root group=root mode=0640
-  with_items:
-    - /etc/skel/.zshrc
+- name: ensure grml-zsh-config is available
+  unarchive:
+    src: "{{ grml_zsh.dest }}"
+    dest: /
+    extra_opts: "--exlcude=.[A-Z]*"
+  when:
+    - grml_zsh.changed
+    - not grml_zsh.failed
+  tags:
+    - config
+    - shell
+
+- name: ensure root uses the global zshrc
+  copy:
+    src: /etc/skel/.zshrc
+    dest: /root/.zshrc
+    remote_src: yes
   tags:
     - config
     - shell
 
 - name: ensure deployment of a fancy vimrc for root
-  copy: src=root/vimrc dest=/root/.vimrc owner=root group=root mode=0640
+  copy:
+    src: root/vimrc
+    dest: /root/.vimrc
+    owner: root
+    group: root
+    mode: 0640
   tags:
     - config
     - shell
     - root
 
 - name: ensure a properly configured root account
-  user: name=root shell=/bin/zsh
+  user:
+    name: root
+    shell: /bin/zsh
   tags:
     - config
     - shell
     - root
 
 - name: ensure that pcspeaker remains silent
-  kernel_blacklist: name=pcspkr state=present
+  kernel_blacklist:
+    name: pcspkr
+    state: present
   notify:
     - rerun depmod
     - update initramfs
-- 
GitLab