Playbooks to a new Lilik
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.7 KiB

7 years ago
7 years ago
  1. ---
  2. - name: configure icinga2-ido-pgsql (host)
  3. debconf:
  4. name: 'icinga2-ido-pgsql'
  5. question: 'icinga2-ido-pgsql/remote/host'
  6. vtype: 'string'
  7. value: 'localhost'
  8. - name: configure icinga2-ido-pgsql (enable)
  9. debconf:
  10. name: 'icinga2-ido-pgsql'
  11. question: 'icinga2-ido-pgsql/enable'
  12. vtype: 'boolean'
  13. value: true
  14. - name: configure icinga2-ido-pgsql (dbconfig-install)
  15. debconf:
  16. name: 'icinga2-ido-pgsql'
  17. question: 'icinga2-ido-pgsql/dbconfig-install'
  18. vtype: 'boolean'
  19. value: true
  20. - name: configure icinga2-ido-pgsql (dbconfig-reinstall)
  21. debconf:
  22. name: 'icinga2-ido-pgsql'
  23. question: 'icinga2-ido-pgsql/dbconfig-reinstall'
  24. vtype: 'boolean'
  25. value: true
  26. # - name: nasty dpkg-reconfigure
  27. # command: "dpkg-reconfigure --frontend noninteractive icinga2-ido-pgsql"
  28. #
  29. # - name: configure icinga2-ido-pgsql (dbconfig-reinstall)
  30. # debconf:
  31. # name: 'icinga2-ido-pgsql'
  32. # question: 'icinga2-ido-pgsql/dbconfig-reinstall'
  33. # vtype: 'boolean'
  34. # value: false
  35. - include_role:
  36. name: service
  37. vars:
  38. service_name: icinga2
  39. service_packages:
  40. - icinga2-ido-pgsql
  41. - monitoring-plugins
  42. - nagios-plugins-contrib
  43. - icinga2
  44. - icingacli
  45. - php-ldap
  46. - php-pgsql
  47. - php-intl
  48. - php-imagick
  49. - icingaweb2-module-monitoring
  50. - icingaweb2
  51. # TODO: log, add a centralized log server
  52. - rsyslog
  53. - rsync
  54. - name: enable ido-pgsql and command features
  55. command: "icinga2 feature enable ido-pgsql command"
  56. register: icinga2_features
  57. changed_when: "'Enabling' in icinga2_features.stdout"
  58. notify: restart icinga2
  59. - name: copy icingaweb2 configuration
  60. synchronize:
  61. src: icingaweb2
  62. dest: /etc
  63. rsync_opts:
  64. - "--chmod Du=rwx,Dg=rwx,Do=,Fu=rw,Fg=rw,Fo= "
  65. - "--chown root:icingaweb2"
  66. - name: enable icingaweb2 monitoring plugin
  67. file:
  68. src: '/usr/share/icingaweb2/modules/monitoring'
  69. dest: '/etc/icingaweb2/enabledModules/monitoring'
  70. state: link
  71. - name:
  72. command: grep -Po 'password = "\K.*?(?=")' /etc/icinga2/features-available/ido-pgsql.conf
  73. register: icinga2_password
  74. changed_when: false
  75. - name: configure icingaweb2 resources
  76. template:
  77. src: icingaweb2/resources.ini.j2
  78. dest: /etc/icingaweb2/resources.ini
  79. owner: root
  80. group: icingaweb2
  81. mode: 0640
  82. - name: create icinga2 hosts directory
  83. file:
  84. path: "{{ item }}"
  85. state: directory
  86. owner: icinga2
  87. group: icinga2
  88. mode: 0770
  89. with_items:
  90. - /etc/icinga2/conf.d/hosts/
  91. - name: add nginx configurations
  92. template:
  93. src: icinga.conf
  94. dest: "/etc/nginx/locations/{{ server_fqdn }}/service.conf"
  95. notify:
  96. - restart nginx