Saltstack Official Apache Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

81 lines
2.6KB

  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. include:
  8. - {{ sls_service_running }}
  9. - {{ sls_package_install }}
  10. {%- if grains['os_family'] in ('Suse', 'Debian',) %}
  11. apache-config-modules-remoteip-cmd-run-mod-a2en:
  12. cmd.run:
  13. - name: a2enmod remoteip
  14. - unless: ls {{ apache.moddir }}/remoteip.load || egrep "^APACHE_MODULES=" /etc/sysconfig/apache2 | grep remoteip
  15. - order: 255
  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. apache-config-modules-remoteip-cmd-run-conf:
  25. cmd.run:
  26. - name: a2enconf remoteip
  27. - unless: ls /etc/apache2/conf-enabled/remoteip.conf
  28. - order: 255
  29. - require:
  30. - pkg: apache-package-install-pkg-installed
  31. - watch_in:
  32. - module: apache-service-running-reload
  33. - require_in:
  34. - module: apache-service-running-restart
  35. - module: apache-service-running-reload
  36. - service: apache-service-running
  37. file.managed:
  38. - name: /etc/apache2/conf-available/remoteip.conf
  39. - template: {{ apache.get('template_engine', 'jinja') }}
  40. - makedirs: True
  41. - context:
  42. apache: {{ apache|json }}
  43. - source:
  44. - salt://apache/files/{{ salt['grains.get']('os_family') }}/conf-available/remoteip.conf.jinja
  45. - require:
  46. - pkg: apache-package-install-pkg-installed
  47. - watch_in:
  48. - module: apache-service-running-restart
  49. - require_in:
  50. - module: apache-service-running-restart
  51. - module: apache-service-running-reload
  52. - service: apache-service-running
  53. - cmd: apache-config-modules-remoteip-cmd-run-conf
  54. {%- elif grains['os_family']=="RedHat" %}
  55. apache-config-modules-remoteip-file-managed-conf:
  56. file.managed:
  57. - name: /etc/httpd/conf.d/remoteip.conf
  58. - template: {{ apache.get('template_engine', 'jinja') }}
  59. - makedirs: True
  60. - context:
  61. apache: {{ apache|json }}
  62. - source:
  63. - salt://apache/files/{{ salt['grains.get']('os_family') }}/conf.modules.d/remoteip.conf.jinja
  64. - require:
  65. - pkg: apache-package-install-pkg-installed
  66. - watch_in:
  67. - module: apache-service-running-restart
  68. - require_in:
  69. - module: apache-service-running-restart
  70. - module: apache-service-running-reload
  71. - service: apache-service-running
  72. {%- endif %}