Add deploy.apache_conf()
for fablib
This commit is contained in:
parent
e83f87afdc
commit
d48e145a91
|
@ -64,19 +64,6 @@ def install_wsgi(python_home=None):
|
|||
enable_conf('wsgi')
|
||||
|
||||
|
||||
def deploy_site(deployer, local_path, name, enable=False):
|
||||
"""
|
||||
Deploy a file to Apache sites-available
|
||||
"""
|
||||
if get_apache_version() == 2.2:
|
||||
path = '/etc/apache2/sites-available/{}'.format(name)
|
||||
else:
|
||||
path = '/etc/apache2/sites-available/{}.conf'.format(name)
|
||||
deployer(local_path, path)
|
||||
if enable:
|
||||
enable_site(name)
|
||||
|
||||
|
||||
def enable_conf(*names):
|
||||
"""
|
||||
Enable the given Apache configurations
|
||||
|
@ -101,6 +88,32 @@ def enable_site(*names):
|
|||
sudo('a2ensite {}'.format(name))
|
||||
|
||||
|
||||
def deploy_conf(deployer, local_path, name, enable=False):
|
||||
"""
|
||||
Deploy a config snippet file to Apache
|
||||
"""
|
||||
version = get_apache_version()
|
||||
if version == 2.2:
|
||||
deployer(local_path, '/etc/apache2/conf.d/{}.conf'.format(name))
|
||||
else:
|
||||
deployer(local_path, '/etc/apache2/conf-available/{}.conf'.format(name))
|
||||
if enable:
|
||||
enable_conf(name)
|
||||
|
||||
|
||||
def deploy_site(deployer, local_path, name, enable=False):
|
||||
"""
|
||||
Deploy a file to Apache sites-available
|
||||
"""
|
||||
if get_apache_version() == 2.2:
|
||||
path = '/etc/apache2/sites-available/{}'.format(name)
|
||||
else:
|
||||
path = '/etc/apache2/sites-available/{}.conf'.format(name)
|
||||
deployer(local_path, path)
|
||||
if enable:
|
||||
enable_site(name)
|
||||
|
||||
|
||||
def restart():
|
||||
"""
|
||||
Restart the Apache web service
|
||||
|
|
|
@ -168,6 +168,10 @@ class Deployer(object):
|
|||
from rattail.fablib.apache import deploy_site
|
||||
deploy_site(self, local_path, name, **kwargs)
|
||||
|
||||
def apache_conf(self, local_path, name, **kwargs):
|
||||
from rattail.fablib.apache import deploy_conf
|
||||
deploy_conf(self, local_path, name, **kwargs)
|
||||
|
||||
def certbot_account(self, uuid, localdir='certbot/account'):
|
||||
"""
|
||||
Deploy files to establish a certbot account on target server
|
||||
|
|
Loading…
Reference in a new issue