From 3349312836a4b330f3b7deb67430bf9df32244df Mon Sep 17 00:00:00 2001
From: "flyingscorpio@clevo" <tfranken@protonmail.com>
Date: Mon, 28 Feb 2022 13:10:58 +0100
Subject: [PATCH] Add role powershell

---
 configs.yml                     |  9 ---------
 playbook.yml                    |  1 +
 roles/powershell/meta/main.yml  |  4 ++++
 roles/powershell/tasks/main.yml | 13 +++++++++++++
 4 files changed, 18 insertions(+), 9 deletions(-)
 create mode 100644 roles/powershell/meta/main.yml
 create mode 100644 roles/powershell/tasks/main.yml

diff --git a/configs.yml b/configs.yml
index 36e88aa..5810a4f 100644
--- a/configs.yml
+++ b/configs.yml
@@ -68,15 +68,6 @@ gitea_backup_rsync:
     - run:
         - sudo systemctl enable gitea_backup_rsync.timer
 
-powershell:
-    - clone:
-        url: https://aur.archlinux.org/powershell-bin.git
-        dest: ~/builds/powershell-bin
-        condition: arch
-    - run:
-        command: cd ~/builds/powershell-bin && makepkg -cirs --needed
-        condition: arch
-
 gaming:
     - run:
         command: sudo cp /etc/pacman.conf /etc/pacman.conf.backup
diff --git a/playbook.yml b/playbook.yml
index c9beeba..5df6982 100644
--- a/playbook.yml
+++ b/playbook.yml
@@ -21,4 +21,5 @@
     - { role: java, tags: java }
     - { role: lilypond, tags: lilypond }
     - { role: latex, tags: latex }
+    - { role: powershell, tags: powershell }
     - { role: protonvpn, tags: protonvpn }
diff --git a/roles/powershell/meta/main.yml b/roles/powershell/meta/main.yml
new file mode 100644
index 0000000..85ceaa8
--- /dev/null
+++ b/roles/powershell/meta/main.yml
@@ -0,0 +1,4 @@
+---
+dependencies:
+  - role: check-sudo
+  - role: git
diff --git a/roles/powershell/tasks/main.yml b/roles/powershell/tasks/main.yml
new file mode 100644
index 0000000..788666a
--- /dev/null
+++ b/roles/powershell/tasks/main.yml
@@ -0,0 +1,13 @@
+---
+- name: Clone powershell-bin
+  git:
+    repo: https://aur.archlinux.org/powershell-bin.git
+    dest: ~/builds/powershell-bin
+    clone: yes
+  when: ansible_distribution == 'Archlinux'
+
+- name: Make and install powershell-bin
+  command:
+    cmd: makepkg -cirs --needed
+    chdir: ~/builds/powershell-bin
+  when: ansible_distribution == 'Archlinux'