Add functions to deploy, enable apache config files
This commit is contained in:
parent
05d6e093a7
commit
bc4a8a686e
2 changed files with 26 additions and 0 deletions
|
@ -92,6 +92,27 @@ def deploy_site(c, deployer, local_path, name, enable=False, **kwargs):
|
|||
enable_site(c, name)
|
||||
|
||||
|
||||
def deploy_conf(c, deployer, local_path, name, enable=False, **kwargs):
|
||||
"""
|
||||
Deploy a config snippet file to Apache
|
||||
"""
|
||||
apache_version = get_version(c)
|
||||
if apache_version == 2.2:
|
||||
deployer(c, local_path, '/etc/apache2/conf.d/{}.conf'.format(name), **kwargs)
|
||||
else:
|
||||
deployer(c, local_path, '/etc/apache2/conf-available/{}.conf'.format(name), **kwargs)
|
||||
if enable:
|
||||
enable_conf(c, name)
|
||||
|
||||
|
||||
def enable_conf(c, *names):
|
||||
"""
|
||||
Enable the given Apache configurations
|
||||
"""
|
||||
for name in names:
|
||||
c.sudo('a2enconf {}'.format(name))
|
||||
|
||||
|
||||
def restart(c):
|
||||
"""
|
||||
Restart the Apache web service
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue