homeserver/friedhof/mgrote_r8152_kernel_module_on_off/tasks/doing.yml

84 lines
2 KiB
YAML
Raw Permalink Normal View History

---
- name: install needed packages
become: true
ansible.builtin.package:
name: "{{ r8152_packages }}"
state: present
register: aptp
- name: add reboot(for safekeeping)
become: true
ansible.builtin.shell: shutdown -r "{{ r8152_safekeeping_reboot_delay }}"
- name: update apt cache
become: true
ansible.builtin.apt:
update_cache: true
register: aptc
- name: updated installed packages
become: true
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: true
ansible.builtin.copy:
src: "files/{{ r8152_filename }}.tar.bz2"
dest: "/tmp/r8152/{{ r8152_filename }}.tar.bz2"
mode: '0775'
- name: extract archive
become: true
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: true #datei liegt also auf dem zielsystem
- name: make
community.general.make:
chdir: "/lib/modules/r8152/{{ r8152_filename }}"
become: true
- name: make install
community.general.make:
chdir: "/lib/modules/r8152/{{ r8152_filename }}"
target: install
become: true
- name: depmod -a
become: true
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: true
ansible.builtin.shell: shutdown -c