salt.modules.apache

Support for Apache

salt.modules.apache.a2dissite(site)

Runs a2dissite for the given site.

This will only be functional on Debian-based operating systems (Ubuntu, Mint, etc).

CLI Examples:

salt '*' apache.a2dissite example.com
salt.modules.apache.a2ensite(site)

Runs a2ensite for the given site.

This will only be functional on Debian-based operating systems (Ubuntu, Mint, etc).

CLI Examples:

salt '*' apache.a2ensite example.com
salt.modules.apache.check_site_enabled(site)

Checks to see if the specific Site symlink is in /etc/apache2/sites-enabled.

This will only be functional on Debian-based operating systems (Ubuntu, Mint, etc).

CLI Examples:

salt '*' apache.check_site_enabled example.com
salt.modules.apache.directives()

Return list of directives together with expected arguments and places where the directive is valid (apachectl -L)

CLI Example:

salt '*' apache.directives
salt.modules.apache.fullversion()

Return server version from apachectl -V

CLI Example:

salt '*' apache.fullversion
salt.modules.apache.modules()

Return list of static and shared modules from apachectl -M

CLI Example:

salt '*' apache.modules
salt.modules.apache.server_status(profile='default')

Get Information from the Apache server-status handler

NOTE: the server-status handler is disabled by default. in order for this function to work it needs to be enabled. http://httpd.apache.org/docs/2.2/mod/mod_status.html

The following configuration needs to exists in pillar/grains each entry nested in apache.server-status is a profile of a vhost/server this would give support for multiple apache servers/vhosts

apache.server-status:
'default':
'url': http://localhost/server-status 'user': someuser 'pass': password 'realm': 'authentication realm for digest passwords' 'timeout': 5

CLI Examples:

salt '*' apache.server_status
salt '*' apache.server_status other-profile
salt.modules.apache.servermods()

Return list of modules compiled into the server (apachectl -l)

CLI Example:

salt '*' apache.servermods
salt.modules.apache.signal(signal=None)

Signals httpd to start, restart, or stop.

CLI Example:

salt '*' apache.signal restart
salt.modules.apache.useradd(pwfile, user, password, opts='')

Add an HTTP user using the htpasswd command. If the htpasswd file does not exist, it will be created. Valid options that can be passed are:

n Don't update file; display results on stdout. m Force MD5 encryption of the password (default). d Force CRYPT encryption of the password. p Do not encrypt the password (plaintext). s Force SHA encryption of the password.

CLI Examples:

salt '*' apache.useradd /etc/httpd/htpasswd larry badpassword
salt '*' apache.useradd /etc/httpd/htpasswd larry badpass opts=ns
salt.modules.apache.userdel(pwfile, user)

Delete an HTTP user from the specified htpasswd file.

CLI Examples:

salt '*' apache.userdel /etc/httpd/htpasswd larry
salt.modules.apache.version()

Return server version from apachectl -v

CLI Example:

salt '*' apache.version
salt.modules.apache.vhosts()

Show the settings as parsed from the config file (currently only shows the virtualhost settings). (apachectl -S) Because each additional virtual host adds to the execution time, this command may require a long timeout be specified.

CLI Example:

salt -t 10 '*' apache.vhosts