Add and enable Apache sites
This commit is contained in:
parent
7992fcc291
commit
87bc4dd4f5
|
@ -11,3 +11,4 @@ common__nginx__upstreams: []
|
||||||
common__nginx__sites: []
|
common__nginx__sites: []
|
||||||
|
|
||||||
common__apache__remove_default: true
|
common__apache__remove_default: true
|
||||||
|
common__apache__sites: []
|
||||||
|
|
|
@ -28,3 +28,20 @@
|
||||||
path: '{{ common__apache__enabled_dir }}/000-default.conf'
|
path: '{{ common__apache__enabled_dir }}/000-default.conf'
|
||||||
when: common__apache__remove_default|bool
|
when: common__apache__remove_default|bool
|
||||||
notify: common | Restart Apache
|
notify: common | Restart Apache
|
||||||
|
|
||||||
|
- name: Add Apache sites
|
||||||
|
template:
|
||||||
|
src: 'templates/apache/{{ item.type }}.conf'
|
||||||
|
dest: '{{ common__apache__available_dir }}/{{ item.domain }}.conf'
|
||||||
|
mode: 'u=rw,g=r,o=r'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
with_items: '{{ common__apache__sites }}'
|
||||||
|
notify: common | Restart Apache
|
||||||
|
|
||||||
|
- name: Enable Apache sites
|
||||||
|
command: '/usr/sbin/a2ensite "{{ item.domain }}.conf"'
|
||||||
|
register: common__apache__enable_apache_sites_result
|
||||||
|
changed_when: "common__apache__enable_apache_sites_result.stdout is search('Enabling site {{ item.domain }}')"
|
||||||
|
with_items: '{{ common__apache__sites }}'
|
||||||
|
notify: common | Restart Apache
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
NameVirtualHost *:80
|
||||||
|
|
||||||
|
<VirtualHost *:80>
|
||||||
|
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||||
|
|
||||||
|
ServerName {{ item.domain }}
|
||||||
|
|
||||||
|
Redirect permanent / https://wiki.crypto-libertarian.com
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
<VirtualHost _default_:443>
|
||||||
|
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||||
|
|
||||||
|
ServerName {{ item.domain }}
|
||||||
|
|
||||||
|
DocumentRoot {{ item.root }}
|
||||||
|
|
||||||
|
SSLEngine on
|
||||||
|
SSLCertificateFile {{ item.cert }}
|
||||||
|
SSLCertificateKeyFile {{ item.key }}
|
||||||
|
SSLCertificateChainFile {{ item.chain }}
|
||||||
|
</VirtualHost>
|
Loading…
Reference in New Issue