mg
c5af0719aa
rolle umbenannt Co-authored-by: Michael Grote <michael.grote@posteo.de> Reviewed-on: mg/ansible#122 Co-Authored-By: mg <mg@noreply.git.mgrote.net> Co-Committed-By: mg <mg@noreply.git.mgrote.net>
83 lines
2.1 KiB
YAML
83 lines
2.1 KiB
YAML
---
|
|
- 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
|