aboutsummaryrefslogtreecommitdiffstats
path: root/roles/common
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2020-11-15 17:26:32 +0100
committerbinary <me@rgoncalves.se>2020-11-15 17:26:32 +0100
commitaea6b114e050545ccc8b953c579d53c9158e238b (patch)
tree7cbeb2ad790638e433c21f1452dded1588949d2e /roles/common
parent5bcecbf08db7013ba4de12e492961e2cba6e6b8a (diff)
downloadinfrastructure-aea6b114e050545ccc8b953c579d53c9158e238b.tar.gz
I'm so lazy so ignore this cimment this time pls
Diffstat (limited to 'roles/common')
-rw-r--r--roles/common/tasks/init_alpine.yml38
-rw-r--r--roles/common/tasks/init_openbsd.yml10
-rw-r--r--roles/common/tasks/main.yml35
-rw-r--r--roles/common/vars/main.yml26
4 files changed, 86 insertions, 23 deletions
diff --git a/roles/common/tasks/init_alpine.yml b/roles/common/tasks/init_alpine.yml
new file mode 100644
index 0000000..68689bc
--- /dev/null
+++ b/roles/common/tasks/init_alpine.yml
@@ -0,0 +1,38 @@
+
+# common ~~ tasks/init_alpine.yml
+# specific tasks for Alpine initalization
+
+---
+
+- name: Setup repositories for Alpine
+ shell: |
+ echo "https://mirror.ungleich.ch/mirror/packages/alpine/edge/main/" > /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/releases/" >> /etc/apk/repositories
+
+- name: Download virtio_vmmci
+ git:
+ repo: "https://github.com/voutilad/virtio_vmmci"
+ dest: /data/git/virtio_vmmci
+
+- name: Install virtio_vmmci
+ shell: make && make install && modprobe virtio_vmmci
+ args:
+ chdir: /data/git/virtio_vmmci
+
+- name: Enable virtio_vmmci module
+ shell: echo "virtio_vmmci" > /etc/modules-load.d/virtio_vmmci.conf
+
+- name: Download vmm_clock module
+ git:
+ repo: "https://github.com/voutilad/vmm_clock"
+ dest: /data/git/vmm_clock
+
+- name: Install vmm_clock module
+ shell: make && make install && modprobe vmm_clock
+ args:
+ chdir: /data/git/vmm_clock
+
+- name: Enable vmm_clock module
+ shell: echo "vmm_clock" > /etc/modules-load.d/vmm_clock.conf
+
diff --git a/roles/common/tasks/init_openbsd.yml b/roles/common/tasks/init_openbsd.yml
new file mode 100644
index 0000000..d4dae41
--- /dev/null
+++ b/roles/common/tasks/init_openbsd.yml
@@ -0,0 +1,10 @@
+
+# common ~~ tasks/init_alpine.yml
+# specific tasks for Openbsd initalization
+
+---
+
+- name: Setup repositories for Openbsd
+ shell: echo "https://mirror.ungleich.ch/pub/OpenBSD/" > /etc/installurl
+
+
diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml
index acbcb1c..1bc657f 100644
--- a/roles/common/tasks/main.yml
+++ b/roles/common/tasks/main.yml
@@ -3,38 +3,30 @@
---
-- name: Setup repositories for Alpine
- shell: |
- echo "https://mirror.ungleich.ch/mirror/packages/alpine/edge/main/" > /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/releases/" >> /etc/apk/repositories
- when: "'alpine' in group_names"
-
-- name: Check installation of package "{{ item }}"
+- name: Check installation of packages
package:
name: "{{ item }}"
state: present
+ loop: "{{ common_packages +lookup('vars', 'common_packages_' + ansible_distribution | lower) }}"
+ ignore_errors: true
+- name: Check existence of primary directory
+ file:
+ path: /data/{{ item }}
+ state: directory
loop:
- - "{{ packages.zsh }}"
- - "{{ packages.curl }}"
- - "{{ packages.tmux }}"
- - "{{ packages.wget }}"
- - "{{ packages.figlet }}"
- - "{{ packages.neovim }}"
- - "{{ packages.pip }}"
- - util-linux
- - shadow
+ - git
- ignore_errors: yes
+- include: "init_{{ ansible_distribution | lower }}.yml"
+ ignore_errors: true
- name: Copy zshrc configuration file
copy:
src: zshrc
dest: "{{ path_zshrc }}"
owner: root
- group: "{{ group.root }}"
+ group: "{{ group_root }}"
mode: 0644
- name: Copy tmux configuration file
@@ -42,7 +34,7 @@
src: tmux.conf
dest: /etc/tmux.conf
owner: root
- group: "{{ group.root }}"
+ group: "{{ group_root }}"
mode: 0644
- name: Synchronize host hostname with config hostname
@@ -53,9 +45,6 @@
shell: awk -F ":" '{ if($3 == 0 || $3 > 999 && $3 < 16000) { print $1 }}' /etc/passwd
register: valid_users_shell
-- debug:
- var: valid_users_shell.stdout
-
- name: Change shell for all valid users to zsh
user:
name: "{{ item }}"
diff --git a/roles/common/vars/main.yml b/roles/common/vars/main.yml
new file mode 100644
index 0000000..7cad228
--- /dev/null
+++ b/roles/common/vars/main.yml
@@ -0,0 +1,26 @@
+
+# common ~~ vars/main.yml
+
+---
+
+common_packages:
+ - zsh
+ - curl
+ - wget
+ - figlet
+ - neovim
+ - git
+
+common_packages_alpine:
+ # common packages
+ - tmux
+ - util-linux
+ - shadow
+ - wireguard-virt
+ - wireguard-tools
+ # vmm_clock module make dependcy
+ - gcc
+ - make
+ - linux-virt-dev
+
+common_packages_openbsd:
remember that computers suck.