diff --git a/playbooks/3_service/proxmox.yml b/playbooks/3_service/proxmox.yml index 9244288d..988ed397 100644 --- a/playbooks/3_service/proxmox.yml +++ b/playbooks/3_service/proxmox.yml @@ -20,8 +20,4 @@ tags: "cv4pve", when: "'pve2.grote.lan' in inventory_hostname" } - { role: mgrote.r8152_kernel_module, - tags: "r8152", - when: "'pve3.grote.lan' in inventory_hostname" } - - { role: mgrote.r8152_kernel_module, - tags: "r8152", - when: "'pve4.grote.lan' in inventory_hostname" } + tags: "r8152" } diff --git a/roles/mgrote.r8152_kernel_module/tasks/assert.yml b/roles/mgrote.r8152_kernel_module/tasks/assert.yml new file mode 100644 index 00000000..894272c4 --- /dev/null +++ b/roles/mgrote.r8152_kernel_module/tasks/assert.yml @@ -0,0 +1,20 @@ +--- + - name: check if module is installed - folder + become: yes + stat: + path: "/lib/modules/r8152" + 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 install-tasks + include_tasks: doing.yml + when: (module_in_lsmod.stdout.find('r8152') == -1) and (folder_exists.stat.exists == false) + + - name: include dkms-tasks + include_tasks: dkms.yml + when: (module_in_lsmod.stdout.find('r8152') == -1) and (folder_exists.stat.exists == false) diff --git a/roles/mgrote.r8152_kernel_module/tasks/main.yml b/roles/mgrote.r8152_kernel_module/tasks/main.yml index 5c3121ef..70c62e60 100644 --- a/roles/mgrote.r8152_kernel_module/tasks/main.yml +++ b/roles/mgrote.r8152_kernel_module/tasks/main.yml @@ -1,20 +1,4 @@ --- - - name: check if module is installed - folder - become: yes - stat: - path: "/lib/modules/r8152" - 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 install-tasks (task get skipped if the folder or the module exists or r8152_module_needed == false) - include_tasks: doing.yml - when: (module_in_lsmod.stdout.find('r8152') == -1) and (r8152_module_needed == true) and (folder_exists.stat.exists == false) - - - name: include dkms-tasks (task get skipped if the folder or the module exists or r8152_module_needed == false) - include_tasks: dkms.yml - when: (module_in_lsmod.stdout.find('r8152') == -1) and (r8152_module_needed == true) and (folder_exists.stat.exists == false) + - name: include assert-tasks + include_tasks: assert.yml + when: r8152_module_needed == true