r8152: assert (#188)

Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#188
Co-authored-by: mg <mg@noreply.git.mgrote.net>
Co-committed-by: mg <mg@noreply.git.mgrote.net>
This commit is contained in:
Michael Grote 2021-08-16 21:57:16 +02:00
parent 7a54f29995
commit a6a4c48494
3 changed files with 24 additions and 24 deletions

View file

@ -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" }

View file

@ -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)

View file

@ -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