apache¶
Support for Apache
Note
The functions in here are generic functions designed to work with
all implementations of Apache. Debian-specific functions have been moved into
deb_apache.py, but will still load under the apache namespace when a
Debian-based system is detected.
- saltext.apache.modules.apache.version()[source]¶
Return server version (
apachectl -v)CLI Example:
salt '*' apache.version
- saltext.apache.modules.apache.fullversion()[source]¶
Return server version (
apachectl -V)CLI Example:
salt '*' apache.fullversion
- saltext.apache.modules.apache.modules()[source]¶
Return list of static and shared modules (
apachectl -M)CLI Example:
salt '*' apache.modules
- saltext.apache.modules.apache.servermods()[source]¶
Return list of modules compiled into the server (
apachectl -l)CLI Example:
salt '*' apache.servermods
- saltext.apache.modules.apache.directives()[source]¶
Return list of directives together with expected arguments and places where the directive is valid (
apachectl -L)CLI Example:
salt '*' apache.directives
- saltext.apache.modules.apache.vhosts()[source]¶
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 by using-t 10.CLI Example:
salt -t 10 '*' apache.vhosts
- saltext.apache.modules.apache.signal(signal=None)[source]¶
Signals httpd to start, restart, or stop.
CLI Example:
salt '*' apache.signal restart
- saltext.apache.modules.apache.useradd(pwfile, user, password, opts='')[source]¶
Add HTTP user using the
htpasswdcommand. If thehtpasswdfile 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 hashing of the password (default). d Force CRYPT(3) hashing of the password. p Do not hash the password (plaintext). s Force SHA1 hashing of the password.
CLI Examples:
salt '*' apache.useradd /etc/httpd/htpasswd larry badpassword salt '*' apache.useradd /etc/httpd/htpasswd larry badpass opts=ns
- saltext.apache.modules.apache.userdel(pwfile, user)[source]¶
Delete HTTP user from the specified
htpasswdfile.CLI Example:
salt '*' apache.userdel /etc/httpd/htpasswd larry
- saltext.apache.modules.apache.server_status(profile='default')[source]¶
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. See 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-statusis 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
- saltext.apache.modules.apache.config(name, config, edit=True)[source]¶
Create VirtualHost configuration files
- name
File for the virtual host
- config
VirtualHost configurations
Note
This function is not meant to be used from the command line. Config is meant to be an ordered dict of all of the apache configs.
CLI Example:
salt '*' apache.config /etc/httpd/conf.d/ports.conf config="[{'Listen': '22'}]"
Support for Apache
Please note: The functions in here are Debian-specific. Placing them in this
separate file will allow them to load only on Debian-based systems, while still
loading under the apache namespace.
- saltext.apache.modules.deb_apache.__virtual__()[source]¶
Only load the module if apache is installed
- saltext.apache.modules.deb_apache.check_site_enabled(site)[source]¶
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 '*' apache.check_site_enabled example.com.conf
- saltext.apache.modules.deb_apache.a2ensite(site)[source]¶
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
- saltext.apache.modules.deb_apache.a2dissite(site)[source]¶
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
- saltext.apache.modules.deb_apache.check_mod_enabled(mod)[source]¶
Checks to see if the specific mod symlink is in /etc/apache2/mods-enabled.
This will only be functional on Debian-based operating systems (Ubuntu, Mint, etc).
CLI Examples:
salt '*' apache.check_mod_enabled status salt '*' apache.check_mod_enabled status.load salt '*' apache.check_mod_enabled status.conf
- saltext.apache.modules.deb_apache.a2enmod(mod)[source]¶
Runs a2enmod for the given mod.
This will only be functional on Debian-based operating systems (Ubuntu, Mint, etc).
CLI Examples:
salt '*' apache.a2enmod vhost_alias
- saltext.apache.modules.deb_apache.a2dismod(mod)[source]¶
Runs a2dismod for the given mod.
This will only be functional on Debian-based operating systems (Ubuntu, Mint, etc).
CLI Examples:
salt '*' apache.a2dismod vhost_alias
- saltext.apache.modules.deb_apache.check_conf_enabled(conf)[source]¶
Added in version 2016.3.0.
Checks to see if the specific conf symlink is in /etc/apache2/conf-enabled.
This will only be functional on Debian-based operating systems (Ubuntu, Mint, etc).
CLI Examples:
salt '*' apache.check_conf_enabled security salt '*' apache.check_conf_enabled security.conf
- saltext.apache.modules.deb_apache.a2enconf(conf)¶
Added in version 2016.3.0.
Runs a2enconf for the given conf.
This will only be functional on Debian-based operating systems (Ubuntu, Mint, etc).
CLI Examples:
salt '*' apache.a2enconf security
- saltext.apache.modules.deb_apache.a2disconf(conf)¶
Added in version 2016.3.0.
Runs a2disconf for the given conf.
This will only be functional on Debian-based operating systems (Ubuntu, Mint, etc).
CLI Examples:
salt '*' apache.a2disconf security
Support for Apache
Please note: The functions in here are SUSE-specific. Placing them in this
separate file will allow them to load only on SUSE systems, while still
loading under the apache namespace.
- saltext.apache.modules.suse_apache.__virtual__()[source]¶
Only load the module if apache is installed.
- saltext.apache.modules.suse_apache.check_mod_enabled(mod)[source]¶
Checks to see if the specific apache mod is enabled.
This will only be functional on operating systems that support a2enmod -l to list the enabled mods.
CLI Example:
salt '*' apache.check_mod_enabled status