|
1 class sysconfig::apache ( |
|
2 $vhost = hiera('sysconfig::params::vhost', $sysconfig::params::vhost), |
|
3 ) inherits sysconfig::params { |
|
4 notify {'apache': name => "\$vhost : ${vhost}", withpath => true } |
|
5 |
|
6 #remove system apache |
|
7 # package { "audit-libs": |
|
8 # ensure => present |
|
9 # }-> |
|
10 # package {"rhscl-httpd24-epel-7-x86_64": |
|
11 # ensure => present, |
|
12 # source => "https://www.softwarecollections.org/en/scls/rhscl/httpd24/epel-7-x86_64/download/rhscl-httpd24-epel-7-x86_64.noarch.rpm", |
|
13 # provider => rpm, |
|
14 # }-> |
|
15 # class { '::apache': |
|
16 # default_vhost => false, |
|
17 # apache_name => 'httpd24-httpd', |
|
18 # service_name => 'httpd24-httpd', |
|
19 # httpd_dir => "/opt/rh/httpd24/root/etc/httpd", |
|
20 # server_root => "/opt/rh/httpd24/root/etc/httpd", |
|
21 # conf_dir => "/opt/rh/httpd24/root/etc/httpd/conf", |
|
22 # confd_dir => "/opt/rh/httpd24/root/etc/httpd/conf.d", |
|
23 # mod_dir => "/opt/rh/httpd24/root/etc/httpd/conf.d", |
|
24 # vhost_dir => "/opt/rh/httpd24/root/etc/httpd/conf.d", |
|
25 # ports_file => "/opt/rh/httpd24/root/etc/httpd/conf.d/ports.conf" |
|
26 # } |
|
27 # class { '::apache': |
|
28 # default_vhost => false, |
|
29 # server_signature => 'off', |
|
30 # server_tokens => 'prod' |
|
31 # } |
|
32 # file {[ "/var/www/corpusdelaparole", |
|
33 # "/var/www/corpusdelaparole/corpus", |
|
34 # "/var/www/corpusdelaparole/drupal"]: |
|
35 # ensure => directory, |
|
36 # owner => 'apache', |
|
37 # group => 'apache' |
|
38 # }-> |
|
39 # file { "/etc/www": |
|
40 # ensure => directory, |
|
41 # }-> |
|
42 # ::apache::vhost { $vhost: |
|
43 # port => '80', |
|
44 # docroot => "/var/www/corpusdelaparole/drupal", |
|
45 # options => ['-indexes'], |
|
46 # aliases => [ |
|
47 # { alias => '/corpus', path => "/var/www/corpusdelaparole/corpus/public" }, |
|
48 # ], |
|
49 # use_optional_includes => true, |
|
50 # directories => [ |
|
51 # { |
|
52 # path => "/var/www/corpusdelaparole/drupal", |
|
53 # allow_override => ['all',] |
|
54 # }, |
|
55 # { |
|
56 # path => "/var/www/corpusdelaparole/corpus/public", |
|
57 # allow_override => ['all',], |
|
58 # } |
|
59 # ], |
|
60 # custom_fragment => " <Location /corpus>\n IncludeOptional /etc/www/corpus_env.con[f]\n </Location>", |
|
61 # } |
|
62 |
|
63 $apache_packages = [ |
|
64 'httpd' |
|
65 ] |
|
66 $corpus_folders = [ |
|
67 "/var/www/corpusdelaparole", |
|
68 "/var/www/corpusdelaparole/corpus", |
|
69 "/var/www/corpusdelaparole/drupal" |
|
70 ] |
|
71 |
|
72 package { $apache_packages: |
|
73 ensure => present, |
|
74 } |
|
75 |
|
76 service { "httpd": |
|
77 ensure => running, |
|
78 enable => true, |
|
79 require => Package['httpd'] |
|
80 } |
|
81 |
|
82 file { $corpus_folders: |
|
83 ensure => directory, |
|
84 owner => 'apache', |
|
85 group => 'apache', |
|
86 require => Package['httpd'] |
|
87 } |
|
88 |
|
89 file { "/etc/www": |
|
90 ensure => directory, |
|
91 } |
|
92 |
|
93 file { ["/etc/httpd/conf.d/userdir.conf", "/etc/httpd/conf.d/autoindex.conf"]: |
|
94 ensure => absent, |
|
95 require => Package['httpd'], |
|
96 notify => Service['httpd'] |
|
97 } |
|
98 file { "/etc/httpd/conf/httpd.conf": |
|
99 ensure => file, |
|
100 source => "puppet:///modules/sysconfig/httpd/httpd.conf", |
|
101 require => Package['httpd'], |
|
102 notify => Service['httpd'] |
|
103 } |
|
104 file { "/etc/httpd/conf.d/welcome.conf": |
|
105 ensure => file, |
|
106 source => "puppet:///modules/sysconfig/httpd/welcome.conf", |
|
107 require => Package['httpd'], |
|
108 notify => Service['httpd'] |
|
109 } |
|
110 file { "/etc/httpd/conf.d/10-corpusdelaparole.conf": |
|
111 ensure => file, |
|
112 content => template("sysconfig/httpd/vhost.conf.erb"), |
|
113 require => [Package['httpd'], File['/etc/www'], File[$corpus_folders]], |
|
114 notify => Service['httpd'] |
|
115 } |
|
116 |
|
117 exec { "open-http-port": |
|
118 command => "firewall-cmd --permanent --add-port=80/tcp", |
|
119 path => [ '/bin', '/usr/bin', '/usr/local/bin' ] |
|
120 }-> |
|
121 exec { "open-http-port-reload": |
|
122 command => "firewall-cmd --reload", |
|
123 path => [ '/bin', '/usr/bin', '/usr/local/bin' ] |
|
124 } |
|
125 |
|
126 #remove |
|
127 #/etc/httpd/conf.d/userdir.conf |
|
128 #/etc/httpd/conf.d/autotindex.conf |
|
129 #/etc/httpd/conf.d/welcome.conf |
|
130 |
|
131 } |