aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2021-01-19 22:11:01 +0100
committerbinary <me@rgoncalves.se>2021-01-19 22:11:01 +0100
commit9cfe019325bcc08be8f2c1bf5174e67d6c2ce78e (patch)
tree0c67a7a75ea635a4682f6975ac1093eea1752812
parent5e845b2f8d5023ed2bf6bbee697839ff4e062fc9 (diff)
downloadinfrastructure-9cfe019325bcc08be8f2c1bf5174e67d6c2ce78e.tar.gz
Transform raw shell tasks into portable ansible tasks
-rw-r--r--roles/repositories/tasks/main.yml21
-rw-r--r--roles/repositories/vars/main.yml15
2 files changed, 27 insertions, 9 deletions
diff --git a/roles/repositories/tasks/main.yml b/roles/repositories/tasks/main.yml
index 780caab..27ec3cb 100644
--- a/roles/repositories/tasks/main.yml
+++ b/roles/repositories/tasks/main.yml
@@ -5,14 +5,17 @@
---
- name: ensure mirrors for openbsd systems
- shell: echo "https://mirror.ungleich.ch/mirror/openbsd" > /etc/installurl
- when: os_distribution == "openbsd"
+ lineinfile:
+ path: /etc/installurl
+ regexp: "^{{ item }}"
+ line: "{{ item }}"
+ loop: "{{ repositories_openbsd }}"
+ when: ansible_distribution == "OpenBSD"
- name: ensure mirrors for alpine systems
- shell: |
- echo "https://mirror.ungleich.ch/mirror/packages/alpine/latest-stable/main" > /etc/apk/repositories
- echo "https://mirror.ungleich.ch/mirror/packages/alpine/latest-stable/community" >> /etc/apk/repositories
- echo "https://mirror.ungleich.ch/mirror/packages/alpine/edge/community/" >> /etc/apk/repositories
- echo "https://mirror.ungleich.ch/mirror/packages/alpine/edge/testing/" >> /etc/apk/repositories
- when: os_distribution == "alpine"
-
+ lineinfile:
+ path: /etc/apk/repositories
+ regexp: "^{{ item }}"
+ line: "{{ item }}"
+ loop: "{{ repositories_alpine }}"
+ when: ansible_distribution == "Alpine"
diff --git a/roles/repositories/vars/main.yml b/roles/repositories/vars/main.yml
new file mode 100644
index 0000000..c9817a3
--- /dev/null
+++ b/roles/repositories/vars/main.yml
@@ -0,0 +1,15 @@
+
+# repositories ~~ roles/repositories/vars/main.yml
+# repositories urls
+
+---
+
+repositories_openbsd:
+ - https://mirror.ungleich.ch/mirror/openbsd
+
+repositories_alpine:
+ - https://mirror.ungleich.ch/mirror/packages/alpine/latest-stable/main
+ - https://mirror.ungleich.ch/mirror/packages/alpine/latest-stable/community
+ - https://mirror.ungleich.ch/mirror/packages/alpine/edge/community/
+ - https://mirror.ungleich.ch/mirror/packages/alpine/edge/testing/
+
remember that computers suck.