main.yml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. - name: Update hosts file
  2. lineinfile:
  3. path: /etc/hosts
  4. insertafter: '^127\.0\.0\.1'
  5. line: '127.0.0.1 stat.localhost zbx.localhost'
  6. owner: root
  7. group: root
  8. mode: 0644
  9. backup: yes
  10. - name: Create Nginx custom.d directory
  11. file:
  12. path: /etc/nginx/custom.d
  13. state: directory
  14. mode: 0755
  15. - name: Upload Nginx restricted config
  16. template:
  17. src=nginx_restricted_conf.j2
  18. dest=/etc/nginx/custom.d/restricted.conf
  19. # notify:
  20. # - reload nginx
  21. - name: Upload Nginx stat config
  22. template:
  23. src=nginx_stat_conf.j2
  24. dest=/etc/nginx/conf.d/00_stat.conf
  25. # notify:
  26. # - reload nginx
  27. - name: Create zabbix spool directory
  28. file:
  29. path: /var/spool/zabbix
  30. state: directory
  31. mode: 0755
  32. owner: zabbix
  33. group: zabbix
  34. - name: Create config for Zabbix
  35. copy: src=nginx.conf dest=/etc/zabbix/zabbix_agentd.d/nginx.conf
  36. notify:
  37. - restart zabbix-agent
  38. - name: Create script for Zabbix
  39. copy:
  40. src: nginx.sh
  41. dest: /etc/zabbix/scripts/nginx.sh
  42. mode: 0755
  43. backup: yes
  44. owner: zabbix
  45. group: zabbix
  46. notify:
  47. - restart zabbix-agent