diff --git a/group_vars/all.yml b/group_vars/all.yml index 79d70c42..082a744a 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -122,6 +122,7 @@ - acl - vim - rsync + - at programs_only_physical: - hddtemp - ipmitool diff --git a/host_vars/pve3.grote.lan.yml b/host_vars/pve3.grote.lan.yml index 2e72ebde..05c73cf6 100644 --- a/host_vars/pve3.grote.lan.yml +++ b/host_vars/pve3.grote.lan.yml @@ -46,3 +46,5 @@ ### mgrote.apcupsd apcupsd_nis_master: false apcupsd_nis_master_hostname: pve2.grote.lan + ### mgrote.r8152_kernel_module + r8152_module_needed: true diff --git a/host_vars/pve4.grote.lan.yml b/host_vars/pve4.grote.lan.yml index 7894c888..2e0e2ddd 100644 --- a/host_vars/pve4.grote.lan.yml +++ b/host_vars/pve4.grote.lan.yml @@ -46,3 +46,5 @@ ### mgrote.apcupsd apcupsd_nis_master: false apcupsd_nis_master_hostname: pve2.grote.lan + ### mgrote.r8152_kernel_module + r8152_module_needed: true diff --git a/playbooks/base/1_bootstrap.yml b/playbooks/base/1_bootstrap.yml index 30293fcd..5c203396 100644 --- a/playbooks/base/1_bootstrap.yml +++ b/playbooks/base/1_bootstrap.yml @@ -5,7 +5,7 @@ roles: - { role: robertdebock.bootstrap, tags: "bootstrap", become: yes} - { role: ryandaniels.create_users, tags: "user", become: yes} - + - { role: mgrote.r8152_kernel_module } vars: ### reobertdebock.bootstrap bootstrap_user: mg diff --git a/playbooks/on-off/r8152.yml b/playbooks/on-off/r8152.yml new file mode 100644 index 00000000..b1a25a38 --- /dev/null +++ b/playbooks/on-off/r8152.yml @@ -0,0 +1,5 @@ +--- +- hosts: all + become: yes + roles: + - { role: mgrote.r8152_kernel_module } diff --git a/roles/mgrote.musterrolle/meta/main.yml b/roles/mgrote.musterrolle/meta/main.yml index 2e3baa88..4d3701d4 100644 --- a/roles/mgrote.musterrolle/meta/main.yml +++ b/roles/mgrote.musterrolle/meta/main.yml @@ -15,3 +15,5 @@ - all galaxy_tags: - system + collections: + - community.general diff --git a/roles/mgrote.r8152_kernel_module/README.md b/roles/mgrote.r8152_kernel_module/README.md new file mode 100644 index 00000000..982e8da6 --- /dev/null +++ b/roles/mgrote.r8152_kernel_module/README.md @@ -0,0 +1,16 @@ +## mgrote.r8152_kernel_module + +### Beschreibung +Installiert das Module r8152 für die 2.5G USB-C Ethernetkarte DN3025 von Digitus. +Startet den PC neu. + +### Funktioniert auf +- [x] ProxMox 6.1 + +### Variablen + Defaults +see [defaults](./defaults/main.yml) + +``r8152_module_needed`` muss pro Host gesetzt werden. + +### Siehe auch + * [Link zum Treiber](https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-usb-3-0-software) diff --git a/roles/mgrote.r8152_kernel_module/defaults/main.yml b/roles/mgrote.r8152_kernel_module/defaults/main.yml new file mode 100644 index 00000000..d4f0dee8 --- /dev/null +++ b/roles/mgrote.r8152_kernel_module/defaults/main.yml @@ -0,0 +1,11 @@ +--- + r8152_filename: r8152.53.56-2.15.0 + r8152_packages: + - pve-headers + - build-essential + - make + r8152_reboot_timeout: 90 + r8152_pre_reboot_delay: 120 + r8152_post_reboot_delay: 60 + r8152_module_needed: false + r8152_safekeeping_reboot_delay: 12 diff --git a/roles/mgrote.r8152_kernel_module/files/r8152.53.56-2.15.0.tar.bz2 b/roles/mgrote.r8152_kernel_module/files/r8152.53.56-2.15.0.tar.bz2 new file mode 100644 index 00000000..6a85f32a Binary files /dev/null and b/roles/mgrote.r8152_kernel_module/files/r8152.53.56-2.15.0.tar.bz2 differ diff --git a/roles/mgrote.r8152_kernel_module/meta/main.yml b/roles/mgrote.r8152_kernel_module/meta/main.yml new file mode 100644 index 00000000..b4b6cedb --- /dev/null +++ b/roles/mgrote.r8152_kernel_module/meta/main.yml @@ -0,0 +1,3 @@ +--- + collections: + - community.general diff --git a/roles/mgrote.r8152_kernel_module/tasks/doing.yml b/roles/mgrote.r8152_kernel_module/tasks/doing.yml new file mode 100644 index 00000000..640f7baf --- /dev/null +++ b/roles/mgrote.r8152_kernel_module/tasks/doing.yml @@ -0,0 +1,83 @@ +--- + - name: install needed packages + become: yes + ansible.builtin.package: + name: "{{ r8152_packages }}" + state: present + register: aptp + + + - name: add reboot(for safekeeping) + become: yes + ansible.builtin.shell: shutdown -r "{{ r8152_safekeeping_reboot_delay }}" + + - name: update apt cache + become: yes + ansible.builtin.apt: + update_cache: yes + register: aptc + + - name: updated installed packages + become: yes + ansible.builtin.package: + upgrade: dist + register: apti + + - name: reboot - 1 + ansible.builtin.reboot: + reboot_timeout: "{{ r8152_reboot_timeout }}" + pre_reboot_delay: "{{ r8152_reboot_timeout }}" + post_reboot_delay: "{{ r8152_post_reboot_delay }}" + when: + - aptp.changed + - apti.changed + - aptc.changed + + - name: create dirs + ansible.builtin.file: + path: "{{ item }}" + state: directory + loop: + - "/tmp/r8152/" + - "/lib/modules/r8152/{{ r8152_filename }}" + + - name: copy archive + become: yes + ansible.builtin.copy: + src: "files/{{ r8152_filename }}.tar.bz2" + dest: "/tmp/r8152/{{ r8152_filename }}.tar.bz2" + mode: '0775' + + - name: extract archive + become: yes + ansible.builtin.unarchive: + src: "/tmp/r8152/{{ r8152_filename }}.tar.bz2" + dest: "/lib/modules/r8152/{{ r8152_filename }}" + mode: a+x + extra_opts: [--strip-components=1] # entfernt die erste Ebene des Archives + remote_src: yes #datei liegt also auf dem zielsystem + + - name: make + community.general.make: + chdir: "/lib/modules/r8152/{{ r8152_filename }}" + become: yes + + - name: make install + community.general.make: + chdir: "/lib/modules/r8152/{{ r8152_filename }}" + target: install + become: yes + + - name: depmod -a + become: yes + ansible.builtin.shell: depmod -a + + - name: reboot - 2 + ansible.builtin.reboot: + reboot_timeout: "{{ r8152_reboot_timeout }}" + pre_reboot_delay: "{{ r8152_reboot_timeout }}" + post_reboot_delay: "{{ r8152_post_reboot_delay }}" + + - name: cancel reboot(for safekeeping) + become: yes + ansible.builtin.shell: shutdown -c diff --git a/roles/mgrote.r8152_kernel_module/tasks/main.yml b/roles/mgrote.r8152_kernel_module/tasks/main.yml new file mode 100644 index 00000000..0b1522b6 --- /dev/null +++ b/roles/mgrote.r8152_kernel_module/tasks/main.yml @@ -0,0 +1,16 @@ +--- + - name: check if module is installed - folder + become: yes + stat: + path: "/lib/modules/r8152/{{ r8152_filename }}" + register: folder_exists + + - name: check if module is installed - lsmod + become: yes + ansible.builtin.shell: lsmod + register: module_in_lsmod + changed_when: False # sorgt dafür das der Task nie als "changed" angezeigt wird + + - name: include tasks (taks get skipped if the folder or the module exists or r8152_module_needed == false) + include_tasks: doing.yml + when: ((folder_exists.stat.exists == False) or (module_in_lsmod.stdout.find('r8152') == -1)) and (r8152_module_needed == true)