main.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ---
  2. - name: install figlet
  3. apt:
  4. pkg: figlet
  5. state: present
  6. - name: check figlet
  7. stat:
  8. path: /usr/bin/figlet
  9. register: figlet_stat
  10. - name: figlet name
  11. command: /usr/bin/figlet -D -c -w 50 {{freifunk.kurzname}}
  12. register: figlethost
  13. check_mode: no
  14. when: figlet_stat.stat.exists
  15. - name: Create /etc/update-motd.d/ directory if not existent
  16. file:
  17. path: /etc/update-motd.d
  18. state: directory
  19. - name: Disable default motd if necessary
  20. file:
  21. path: /etc/update-motd.d/{{ item }}
  22. state: absent
  23. with_items:
  24. - 00-header
  25. - 10-help-text
  26. - name: create motd update script
  27. template:
  28. src: 99-custom.j2
  29. dest: /etc/update-motd.d/99-custom
  30. mode: "u+rwx,g+rx,o+rx"
  31. - name: get /etc/motd state
  32. stat:
  33. path: /etc/motd
  34. register: motd_stat
  35. - name: remove /etc/motd on Ubuntu
  36. file:
  37. path: /etc/motd
  38. state: absent
  39. when: motd_stat.stat.exists and motd_stat.stat.islnk == False
  40. - name: Create /var/run/motd if necessary
  41. file:
  42. path: /var/run/motd
  43. state: touch
  44. when: ansible_distribution == "Debian"
  45. - name: get /var/run/motd state
  46. stat:
  47. path: /var/run/motd
  48. register: run_motd_stat
  49. - name: link /etc/motd to /var/run/motd on Debian
  50. file:
  51. src: /var/run/motd
  52. dest: /etc/motd
  53. state: link
  54. when: ansible_distribution == "Debian" and run_motd_stat.stat.exists