Compare commits
	
		
			3 Commits
		
	
	
		
			c8a157ad49
			...
			088242592a
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								
									
								
								 | 
						088242592a | |
| 
							
							
								
									
								
								 | 
						73a45eafab | |
| 
							
							
								
									
								
								 | 
						2a4534bfa4 | 
							
								
								
									
										17
									
								
								apache.cf
								
								
								
								
							
							
						
						
									
										17
									
								
								apache.cf
								
								
								
								
							| 
						 | 
					@ -142,16 +142,18 @@ files:
 | 
				
			||||||
		create => "true",
 | 
							create => "true",
 | 
				
			||||||
		edit_template => "$(sys.workdir)/inputs/$(def.mfdomain)/templates/httpd.conf.mustache",
 | 
							edit_template => "$(sys.workdir)/inputs/$(def.mfdomain)/templates/httpd.conf.mustache",
 | 
				
			||||||
		template_method => "mustache",
 | 
							template_method => "mustache",
 | 
				
			||||||
 | 
							handle => "apache_main_cfg_crreated",
 | 
				
			||||||
		classes => if_repaired(apache_changed);
 | 
							classes => if_repaired(apache_changed);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
services:
 | 
					services:
 | 
				
			||||||
	"$(apache.service_name)"
 | 
						"$(apache.service_name)"
 | 
				
			||||||
		depends_on => {"apache_editrc","apache_vhost_dir_created"},
 | 
							depends_on => {"apache_editrc","apache_vhost_dir_created","apache_www_dir_created","apache_main_cfg_crreated"},
 | 
				
			||||||
		service_policy => "start",
 | 
							service_policy => "start",
 | 
				
			||||||
		handle => "apache_running";
 | 
							handle => "apache_running";
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	"php_changed|apache_changed"::
 | 
						"php_changed|apache_changed"::
 | 
				
			||||||
		"$(apache.service_name)"
 | 
							"$(apache.service_name)"
 | 
				
			||||||
 | 
							depends_on => {"apache_vhost_dir_created","apache_www_dir_created","apache_main_cfg_crreated"},
 | 
				
			||||||
		service_policy => "restart";
 | 
							service_policy => "restart";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -164,12 +166,21 @@ commands:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bundle agent apache_vhost
 | 
					bundle agent apache_vhost
 | 
				
			||||||
(site)
 | 
					(site_param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
classes:
 | 
					classes:
 | 
				
			||||||
	"delete" expression => $(site[disable]);
 | 
						"delete" expression => $(site[disable]);
 | 
				
			||||||
	"use_ssl" expression => $(site[ssl]);
 | 
						"use_ssl" expression => $(site[ssl]);
 | 
				
			||||||
vars:
 | 
					vars:
 | 
				
			||||||
 | 
						"site_defaults" data => '
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								"aliases":[],
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"site" data => mergedata(site_defaults,site_param);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"cert_file" string => "$(certbot.certbot_dir)/live/$(site[domain])";
 | 
						"cert_file" string => "$(certbot.certbot_dir)/live/$(site[domain])";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"template_file" 
 | 
						"template_file" 
 | 
				
			||||||
| 
						 | 
					@ -206,7 +217,7 @@ files:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
methods:
 | 
					methods:
 | 
				
			||||||
	use_ssl::
 | 
						use_ssl::
 | 
				
			||||||
		"any" usebundle => certbot_cert(@(site),"$(apache.default_html_dir)","$(site[domain])"),
 | 
							"any" usebundle => certbot_cert(@(site),"$(apache.default_html_dir)"), #,"$(site[domain])"),
 | 
				
			||||||
		handle => "apache_ssl_created$(site[domain])";
 | 
							handle => "apache_ssl_created$(site[domain])";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,10 +42,13 @@ packages:
 | 
				
			||||||
			handle => "certbot_installed";
 | 
								handle => "certbot_installed";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bundle agent certbot_cert(site,webroot,domain)
 | 
					bundle agent certbot_cert(site,webroot)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
vars:
 | 
					vars:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"domain" string => "$(site[domain])";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"site_json" string => storejson(@(site));
 | 
						"site_json" string => storejson(@(site));
 | 
				
			||||||
	"args" string => string_mustache(
 | 
						"args" string => string_mustache(
 | 
				
			||||||
			"-d {{domain}} {{#aliases}} -d {{.}} {{/aliases}}",
 | 
								"-d {{domain}} {{#aliases}} -d {{.}} {{/aliases}}",
 | 
				
			||||||
| 
						 | 
					@ -71,7 +74,8 @@ classes:
 | 
				
			||||||
	or => {no_cert_file, certbot_repaired};
 | 
						or => {no_cert_file, certbot_repaired};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
defaults:
 | 
					defaults:
 | 
				
			||||||
	 "webroot" string => "standalone";
 | 
						"webroot" string => "standalone";
 | 
				
			||||||
 | 
						"domain" string => "$(site[domain])";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
methods:
 | 
					methods:
 | 
				
			||||||
	"any" usebundle => install_certbot;
 | 
						"any" usebundle => install_certbot;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,7 @@
 | 
				
			||||||
	ServerAlias {{#vars.apache_vhost.site.aliases}}{{.}} {{/vars.apache_vhost.site.aliases}}
 | 
						ServerAlias {{#vars.apache_vhost.site.aliases}}{{.}} {{/vars.apache_vhost.site.aliases}}
 | 
				
			||||||
	ErrorLog "{{vars.apache.log_dir}}/{{vars.apache_vhost.site.domain}}-error.log"
 | 
						ErrorLog "{{vars.apache.log_dir}}/{{vars.apache_vhost.site.domain}}-error.log"
 | 
				
			||||||
	CustomLog "{{vars.apache.log_dir}}/{{vars.apache_vhost.site.domain}}-access.log" combined
 | 
						CustomLog "{{vars.apache.log_dir}}/{{vars.apache_vhost.site.domain}}-access.log" combined
 | 
				
			||||||
 | 
						{{vars.apache_vhost.site.raw}}
 | 
				
			||||||
</VirtualHost>
 | 
					</VirtualHost>
 | 
				
			||||||
{{/vars.apache_vhost.site.ssl}}
 | 
					{{/vars.apache_vhost.site.ssl}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,6 +49,7 @@
 | 
				
			||||||
	RewriteEngine On
 | 
						RewriteEngine On
 | 
				
			||||||
	Alias /.well-known/acme-challenge/ "{{vars.apache.default_html_dir}}/.well-known/acme-challenge/"
 | 
						Alias /.well-known/acme-challenge/ "{{vars.apache.default_html_dir}}/.well-known/acme-challenge/"
 | 
				
			||||||
	RewriteRule "^/.well-known/acme-challenge/" - [L]
 | 
						RewriteRule "^/.well-known/acme-challenge/" - [L]
 | 
				
			||||||
 | 
						{{vars.apache_vhost.site.raw}}
 | 
				
			||||||
</VirtualHost>
 | 
					</VirtualHost>
 | 
				
			||||||
{{/vars.apache_vhost.site.ssl}}
 | 
					{{/vars.apache_vhost.site.ssl}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue