main.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ---
  2. # Collectd-Daemon fuer Gateway Server
  3. - name: install required packages
  4. apt:
  5. pkg: "{{ item }}"
  6. update_cache: yes
  7. state: present
  8. with_items:
  9. - collectd
  10. - python-pip
  11. - name: install pip packages
  12. pip:
  13. name: "{{ item }}"
  14. state: present
  15. with_items:
  16. - ipaddress
  17. - pybrctl
  18. - name: enable collectd
  19. service: name=collectd enabled=yes
  20. notify:
  21. - restart collectd
  22. - name: create config directory
  23. file: path=/etc/collectd state=directory
  24. notify:
  25. - restart collectd
  26. - name: deploy collectd.conf
  27. template: src=collectd.conf.j2 dest=/etc/collectd/collectd.conf
  28. notify:
  29. - restart collectd
  30. - name: deploy collection.conf
  31. template: src=collection.conf.j2 dest=/etc/collectd/collection.conf
  32. notify:
  33. - restart collectd
  34. - name: deploy filters.conf
  35. template: src=filters.conf.j2 dest=/etc/collectd/filters.conf
  36. notify:
  37. - restart collectd
  38. - name: deploy thresholds.conf
  39. template: src=thresholds.conf.j2 dest=/etc/collectd/thresholds.conf
  40. notify:
  41. - restart collectd
  42. - name: create plugins directory
  43. file: path=/opt/collectd-python state=directory
  44. notify:
  45. - restart collectd
  46. - name: Add type for dhcp stats to types.db
  47. lineinfile: dest=/usr/share/collectd/types.db regexp="^dhcp_leases" line="dhcp_leases active:GAUGE:0:U, touched:GAUGE:0:U"
  48. notify:
  49. - restart collectd
  50. - name: Add type for kea dhcp stats to types.db
  51. lineinfile: dest=/usr/share/collectd/types.db regexp="^kea_leases" line="kea_leases total-addresses:GAUGE:0:U, assigned-addresses:GAUGE:0:U, declined-addresses:GAUGE:0:U, declined-reclaimed-addresses:GAUGE:0:U, reclaimed-leases:GAUGE:0:U, active-leases:GAUGE:0:U"
  52. notify:
  53. - restart collectd
  54. - name: Add type for l2tp stats to types.db
  55. lineinfile: dest=/usr/share/collectd/types.db regexp="^if_count" line="if_count value:GAUGE:0:U"
  56. notify:
  57. - restart collectd
  58. - name: deploy l2tp.py
  59. template: src=l2tp.py.j2 dest=/opt/collectd-python/l2tp.py
  60. notify:
  61. - restart collectd
  62. when: collectd.collect_l2tp and domaenenliste is defined
  63. - name: deploy fastd.py
  64. template: src=fastd.py.j2 dest=/opt/collectd-python/fastd.py
  65. notify:
  66. - restart collectd
  67. when: collectd.collect_fastd
  68. - name: deploy dhcp.py
  69. template: src=dhcp.py.j2 dest=/opt/collectd-python/dhcp.py
  70. notify:
  71. - restart collectd
  72. when: collectd.collect_dhcp and domaenenliste is defined
  73. - name: deploy kea.py
  74. template: src=kea.py.j2 dest=/opt/collectd-python/kea.py
  75. notify:
  76. - restart collectd
  77. when: collectd.collect_dhcp and domaenenliste is defined
  78. - name: deploy ipv4ipv6.py
  79. template: src=ipv4ipv6.py.j2 dest=/opt/collectd-python/ipv4ipv6.py
  80. notify:
  81. - restart collectd
  82. - name: deploy sysctl.py
  83. template: src=sysctl.py.j2 dest=/opt/collectd-python/sysctl.py
  84. notify:
  85. - restart collectd