blob: 8d89577a5958f0eb0a7f3f533f858dd85be1413f [file] [log] [blame]
Filip Pytloun410abc42015-10-06 16:28:31 +02001
2{% set server = salt['grains.filter_by']({
3 'Debian': {
4 'pkgs': ['apache2'],
5 'service': 'apache2',
6 'mod_wsgi': 'libapache2-mod-wsgi',
7 'mod_php': 'libapache2-mod-php5',
Martin819828f49a2017-03-14 11:13:28 +01008 'mod_perl': 'libapache2-mod-perl2',
9 'mod_xsendfile': 'libapache2-mod-xsendfile',
10 'mod_auth_kerb': 'libapache2-mod-auth-kerb',
Filip Pytloun590b5792016-01-27 11:24:29 +010011 'htpasswd_dir': '/etc/apache2',
Filip Pytloun410abc42015-10-06 16:28:31 +020012 'vhost_dir': '/etc/apache2/sites-available',
Filip Pytlounaffb18d2016-02-22 13:58:27 +010013 'conf_dir': '/etc/apache2/conf-available',
Filip Pytloun410abc42015-10-06 16:28:31 +020014 'conf_ext': '.conf',
15 'log_dir': '/var/log/apache2',
Filip Pytlounc0d263b2016-04-06 11:19:34 +020016 'www_dir': '/var/www',
Filip Pytloun5e9662e2016-02-04 11:14:41 +010017 'service_user': 'www-data',
18 'service_group': 'www-data',
sgarbuz950c64d2018-04-26 12:14:38 +030019 'logrotate': {
20 'start_period': '1',
21 'end_period': '3600',
22 },
Filip Pytloun410abc42015-10-06 16:28:31 +020023 },
24 'Arch': {
25 'pkgs': ['apache'],
26 'service': 'httpd',
27 'mod_wsgi': 'wsgi-apache',
28 'mod_php': 'php-apache',
29 'vhost_dir': '/etc/httpd/conf/extra',
Filip Pytloun590b5792016-01-27 11:24:29 +010030 'htpasswd_dir': '/etc/httpd',
Filip Pytloun410abc42015-10-06 16:28:31 +020031 'conf_dir': '/etc/httpd/conf',
32 'conf_ext': '.conf',
33 'log_dir': '/var/log/httpd',
Filip Pytlounc0d263b2016-04-06 11:19:34 +020034 'www_dir': '/var/www',
Filip Pytloun5e9662e2016-02-04 11:14:41 +010035 'service_user': 'apache',
36 'service_group': 'apache',
Filip Pytloun410abc42015-10-06 16:28:31 +020037 },
38 'RedHat': {
39 'pkgs': ['httpd'],
40 'service': 'httpd',
41 'mod_wsgi': 'mod_wsgi',
42 'vhost_dir': '/etc/httpd/conf.d',
Filip Pytloun590b5792016-01-27 11:24:29 +010043 'htpasswd_dir': '/etc/httpd',
Filip Pytloun410abc42015-10-06 16:28:31 +020044 'conf_dir': '/etc/httpd/conf.d',
45 'conf_ext': '.conf',
46 'log_dir': '/var/log/httpd',
47 'www_dir': '/var/www',
Filip Pytloun5e9662e2016-02-04 11:14:41 +010048 'service_user': 'apache',
49 'service_group': 'apache',
Filip Pytloun410abc42015-10-06 16:28:31 +020050 },
51 'FreeBSD': {
52 'pkgs': ['apache22'],
53 'service': 'apache22',
54 'mod_wsgi': 'ap22-mod_wsgi3',
55 'vhost_dir': '/usr/local/etc/apache22/Includes',
Filip Pytloun590b5792016-01-27 11:24:29 +010056 'htpasswd_dir': '/usr/local/etc/apache22',
Filip Pytloun410abc42015-10-06 16:28:31 +020057 'conf_dir': '/usr/local/etc/apache22/Includes',
58 'conf_ext': '',
59 'log_dir': '/var/log/',
60 'www_dir': '/usr/local/www/apache22/',
Filip Pytloun5e9662e2016-02-04 11:14:41 +010061 'service_user': 'apache',
62 'service_group': 'apache',
Filip Pytloun410abc42015-10-06 16:28:31 +020063 },
Martin819828f49a2017-03-14 11:13:28 +010064}, merge=salt['grains.filter_by']({
65 'trusty': {
66 'pkgs': ['apache2', 'apache2-utils'],
67 'service': 'apache2',
68 'mod_wsgi': 'libapache2-mod-wsgi',
69 'mod_php': 'libapache2-mod-php5',
70 'module_php': 'php5',
71 'mod_perl': 'libapache2-mod-perl2',
72 'mod_xsendfile': 'libapache2-mod-xsendfile',
73 'mod_auth_kerb': 'libapache2-mod-auth-kerb',
74 'htpasswd_dir': '/etc/apache2',
75 'vhost_dir': '/etc/apache2/sites-available',
76 'conf_dir': '/etc/apache2/conf-available',
77 'conf_ext': '.conf',
78 'log_dir': '/var/log/apache2',
79 'www_dir': '/var/www',
80 'service_user': 'www-data',
81 'service_group': 'www-data',
sgarbuz950c64d2018-04-26 12:14:38 +030082 'logrotate': {
83 'start_period': '1',
84 'end_period': '3600',
85 },
Martin819828f49a2017-03-14 11:13:28 +010086 },
87 'xenial': {
88 'pkgs': ['apache2'],
89 'service': 'apache2',
90 'mod_wsgi': 'libapache2-mod-wsgi',
91 'mod_php': 'libapache2-mod-php7.0',
92 'module_php': 'php7.0',
93 'mod_perl': 'libapache2-mod-perl2',
94 'mod_xsendfile': 'libapache2-mod-xsendfile',
95 'mod_auth_kerb': 'libapache2-mod-auth-kerb',
96 'htpasswd_dir': '/etc/apache2',
97 'vhost_dir': '/etc/apache2/sites-available',
98 'conf_dir': '/etc/apache2/conf-available',
99 'conf_ext': '.conf',
100 'log_dir': '/var/log/apache2',
101 'www_dir': '/var/www',
102 'service_user': 'www-data',
103 'service_group': 'www-data',
sgarbuz950c64d2018-04-26 12:14:38 +0300104 'logrotate': {
105 'start_period': '1',
106 'end_period': '3600',
107 },
Martin819828f49a2017-03-14 11:13:28 +0100108 },
109}, grain='oscodename', merge=salt['pillar.get']('apache:server'))) %}
Filip Pytloun7cf89962016-01-28 17:12:27 +0100110
111{%- set listen_ports = {} %}
112{%- if server.site is defined %}
113{%- for site_name, site in server.site.iteritems() %}
Vasyl Saienkof4d65a62018-02-06 17:35:51 +0200114{# TODO: move away from managing listen in ports.conf, instead add this directive #}
115{# to specific service config. Currently it conflits with horizon formula, that manage #}
116{# port.conf by theirown, it leads to races when applying horizon/apache states. #}
Oleksii Grudev260d8722018-04-11 17:20:00 +0300117{%- if site.get('type', '') not in ['wsgi', 'proxy', 'static'] %}
Filip Pytloun7cf89962016-01-28 17:12:27 +0100118{%- if site.host.get('port', 80) %}
Vasyl Saienkof4d65a62018-02-06 17:35:51 +0200119{%- do listen_ports.update({site.host.get('port', 80): None}) %}
120{%- endif %}
Filip Pytloun7cf89962016-01-28 17:12:27 +0100121{%- endif %}
122
123{%- endfor %}
124{%- endif %}