main.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. - name: Abhängigkeiten installieren
  2. apt:
  3. pkg: "{{ item }}"
  4. state: present
  5. with_items:
  6. - dkms
  7. - build-essential
  8. - linux-headers-{{ansible_kernel}}
  9. - checkinstall
  10. - pkg-config
  11. - libnl-3-dev
  12. - libnl-genl-3-dev
  13. - name: create directory for batman-adv
  14. file:
  15. name: /opt/batman-adv
  16. state: directory
  17. - name: Download Batman
  18. get_url:
  19. url: "https://downloads.open-mesh.org/batman/releases/batman-adv-{{batman_version}}/batman-adv-{{batman_version}}.tar.gz"
  20. dest: /opt/batman-adv/batman-adv-{{batman_version}}.tar.gz
  21. register: getbatman
  22. - name: batman-Quellen entpacken
  23. unarchive:
  24. src: /opt/batman-adv/batman-adv-{{batman_version}}.tar.gz
  25. dest: /usr/src
  26. remote_src: True
  27. when:
  28. - getbatman.changed
  29. - name: configure dkms
  30. template:
  31. src: dkms.conf
  32. dest: /usr/src/batman-adv-{{batman_version}}/dkms.conf
  33. - stat:
  34. path: /lib/modules/{{ansible_kernel}}/updates/dkms/batman-adv.ko
  35. register: batman_adv_file
  36. - name: Batman bauen
  37. shell: "dkms add -m batman-adv -v {{batman_version}} && dkms build -m batman-adv -v {{batman_version}} && dkms install -m batman-adv -v {{batman_version}}"
  38. when:
  39. - batman_adv_file.stat.exists == False or getbatman.changed
  40. # batctl
  41. - name: create directory for batctl
  42. file:
  43. name: /opt/batctl
  44. state: directory
  45. - name: get batctl
  46. get_url:
  47. url: "https://downloads.open-mesh.org/batman/releases/batman-adv-{{batman_version}}/batctl-{{batman_version}}.tar.gz"
  48. dest: /opt/batctl/batctl-{{batman_version}}.tar.gz
  49. register: getbatctl
  50. - name: batctl-Quellen und entpacken
  51. unarchive:
  52. src: /opt/batctl/batctl-{{batman_version}}.tar.gz
  53. dest: /usr/src
  54. remote_src: True
  55. when:
  56. - getbatctl.changed
  57. - stat: path=/usr/local/sbin/batctl
  58. register: batctl
  59. - name: batctl Version prüfen
  60. shell: '{{batctl.stat.path}} -v | grep -oE "batctl [0-9]+\.[0-9]+"'
  61. when:
  62. - batctl.stat.exists == True
  63. changed_when: False
  64. register: batctl_version
  65. check_mode: no
  66. - name: batctl bauen
  67. shell: "make && checkinstall -y make install"
  68. args:
  69. chdir: /usr/src/batctl-{{batman_version}}
  70. when:
  71. - batctl.stat.exists == False or batctl_version.stdout_lines[0] != "batctl {{batman_version}}"
  72. # - batctl.stat.exists == False or batctl_version.stdout_lines[0] != "batctl batman_version"