Saltstack Official Apache Formula
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

88 linhas
2.7KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=sls
  3. {%- set tplroot = tpldir.split('/')[0] %}
  4. {%- set sls_service_running = tplroot ~ '.service.running' %}
  5. {%- set sls_package_install = tplroot ~ '.package.install' %}
  6. {%- from tplroot ~ "/map.jinja" import apache with context %}
  7. {%- if 'mod_geoip' in apache and 'finger' in grains and grains.osfinger not in ('Leap-42',) %}
  8. include:
  9. - {{ sls_service_running }}
  10. - {{ sls_package_install }}
  11. apache-config-modules-geoip-pkg:
  12. pkg.installed:
  13. - pkgs:
  14. - {{ apache.mod_geoip }}
  15. - {{ apache.mod_geoip_database }}
  16. - require:
  17. - pkg: apache-package-install-pkg-installed
  18. - watch_in:
  19. - module: apache-service-running-restart
  20. - require_in:
  21. - module: apache-service-running-restart
  22. - module: apache-service-running-reload
  23. - service: apache-service-running
  24. {%- if grains['os_family']=="RedHat" %}
  25. apache-config-modules-geoip-conf-file-managed:
  26. file.managed:
  27. - name: {{ apache.confdir }}/geoip.conf
  28. - user: {{ apache.rootuser }}
  29. - group: {{ apache.rootgroup }}
  30. - makedirs: True
  31. - mode: 644
  32. - template: {{ apache.get('template_engine', 'jinja') }}
  33. - context:
  34. apache: {{ apache|json }}
  35. - source:
  36. - salt://apache/files/{{ salt['grains.get']('os_family') }}/geoip.conf
  37. apache-config-modules-geoip-db-file-managed:
  38. file.managed:
  39. - name: /usr/share/GeoIP/GeoIP.dat
  40. - user: {{ apache.rootuser }}
  41. - group: {{ apache.rootgroup }}
  42. - makedirs: True
  43. - mode: 644
  44. - source:
  45. - salt://apache/files/{{ salt['grains.get']('os_family') }}/GeoIP.dat
  46. apache-config-modules-geoip-{{ grains.os_family }}-conf-file-managed:
  47. file.managed:
  48. - name: {{ apache.moddir }}/10-geoip.conf
  49. - makedirs: True
  50. - source:
  51. - salt://apache/files/RedHat/conf.modules.d/10-geoip.conf.jinja
  52. - require:
  53. - pkg: apache-package-install-pkg-installed
  54. - watch_in:
  55. - module: apache-service-running-restart
  56. - require_in:
  57. - module: apache-service-running-restart
  58. - module: apache-service-running-reload
  59. - service: apache-service-running
  60. {%- elif grains['os_family'] in ('Suse', 'Debian',) %}
  61. apache-config-modules-geoip-cmd-run:
  62. cmd.run:
  63. - name: a2enmod geoip
  64. - unless: ls {{ apache.moddir }}/geoip.load || egrep "^APACHE_MODULES=" /etc/sysconfig/apache2 | grep geoip
  65. - order: 255
  66. - require:
  67. - pkg: apache-package-install-pkg-installed
  68. - pkg: apache-config-modules-geoip-pkg
  69. - watch_in:
  70. - module: apache-service-running-restart
  71. - require_in:
  72. - module: apache-service-running-restart
  73. - module: apache-service-running-reload
  74. - service: apache-service-running
  75. {%- endif %}
  76. {%- endif %}