Added Apache2 SSL template, nable SSL by default
This commit is contained in:
		
							parent
							
								
									f3916b1076
								
							
						
					
					
						commit
						b244dc2043
					
				@ -8,9 +8,9 @@ nextcloud_subdomain: nextcloud
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
nextcloud_www_path: '/var/www/nextcloud/'
 | 
					nextcloud_www_path: '/var/www/nextcloud/'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
nextcloud_ssl: false
 | 
					nextcloud_ssl: true
 | 
				
			||||||
nextcloud_ssl_certificate_path: "/etc/ssl/nginx/{{ nextcloud_subdomain }}.{{ domain_name }}.crt"
 | 
					nextcloud_ssl_certificate_path: "/etc/ssl/certs/ssl-cert-snakeoil.pem"
 | 
				
			||||||
nextcloud_ssl_key_path: "/etc/ssl/nginx/{{ nextcloud_subdomain }}.{{ domain_name }}.key"
 | 
					nextcloud_ssl_key_path: "/etc/ssl/private/ssl-cert-snakeoil.key"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Apache configuration
 | 
					# Apache configuration
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,9 +1,19 @@
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
 | 
					- name: Write Apache2 SSL nextcloud.conf file
 | 
				
			||||||
 | 
					  ansible.builtin.template:
 | 
				
			||||||
 | 
					    src: apache2_ssl_nextcloud.conf.j2
 | 
				
			||||||
 | 
					    dest: "{{ nextcloud_apache2_config_path }}"
 | 
				
			||||||
 | 
					    mode: '0644'
 | 
				
			||||||
 | 
					  become: true
 | 
				
			||||||
 | 
					  when: nextcloud_ssl
 | 
				
			||||||
 | 
					  notify: Enable Nextcloud site
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Write Apache2 nextcloud.conf file
 | 
					- name: Write Apache2 nextcloud.conf file
 | 
				
			||||||
  ansible.builtin.template:
 | 
					  ansible.builtin.template:
 | 
				
			||||||
    src: apache2_nextcloud.conf.j2
 | 
					    src: apache2_nextcloud.conf.j2
 | 
				
			||||||
    dest: "{{ nextcloud_apache2_config_path }}"
 | 
					    dest: "{{ nextcloud_apache2_config_path }}"
 | 
				
			||||||
    mode: '0644'
 | 
					    mode: '0644'
 | 
				
			||||||
  become: true
 | 
					  become: true
 | 
				
			||||||
 | 
					  when: not nextcloud_ssl
 | 
				
			||||||
  notify:
 | 
					  notify:
 | 
				
			||||||
    - Enable Nextcloud site
 | 
					    - Enable Nextcloud site
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										32
									
								
								templates/apache2_ssl_nextcloud.conf.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								templates/apache2_ssl_nextcloud.conf.j2
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					# {{ ansible_managed }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<IfModule mod_ssl.c>
 | 
				
			||||||
 | 
						<VirtualHost *:443>
 | 
				
			||||||
 | 
						 	ServerName {{ ansible_hostname }}.{{ domain_name }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							DocumentRoot {{ nextcloud_www_path }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							ErrorLog ${APACHE_LOG_DIR}/error.log
 | 
				
			||||||
 | 
							CustomLog ${APACHE_LOG_DIR}/access.log combined
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							SSLEngine on
 | 
				
			||||||
 | 
							SSLCertificateFile {{ nextcloud_ssl_certificate_path }}
 | 
				
			||||||
 | 
							SSLCertificateKeyFile {{ nextcloud_ssl_key_path }}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						 	<Directory {{ nextcloud_www_path }}>
 | 
				
			||||||
 | 
						 		Require all granted
 | 
				
			||||||
 | 
						 		AllowOverride All
 | 
				
			||||||
 | 
						 		Options FollowSymLinks MultiViews
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						 		<IfModule mod_dav.c>
 | 
				
			||||||
 | 
						 			Dav off
 | 
				
			||||||
 | 
						 		</IfModule>
 | 
				
			||||||
 | 
						 	</Directory>
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							<FilesMatch "\.php$">
 | 
				
			||||||
 | 
								SSLOptions +StdEnvVars
 | 
				
			||||||
 | 
							</FilesMatch>
 | 
				
			||||||
 | 
						</VirtualHost>
 | 
				
			||||||
 | 
					</IfModule>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user