haproxy
¶
Support for haproxy
Added in version 2014.7.0.
- saltext.haproxy.modules.haproxyconn.__virtual__()[source]¶
Only load the module if haproxyctl is installed
- saltext.haproxy.modules.haproxyconn.list_servers(backend, socket='/var/run/haproxy.sock', objectify=False)[source]¶
List servers in haproxy backend.
- backend
haproxy backend
- socket
haproxy stats socket, default
/var/run/haproxy.sock
CLI Example:
salt '*' haproxy.list_servers mysql
- saltext.haproxy.modules.haproxyconn.wait_state(backend, server, value='up', timeout=300, socket='/var/run/haproxy.sock')[source]¶
Wait for a specific server state
- backend
haproxy backend
- server
targeted server
- value
state value
- timeout
timeout before giving up state value, default 5 min
- socket
haproxy stats socket, default
/var/run/haproxy.sock
CLI Example:
salt '*' haproxy.wait_state mysql server01 up 60
- saltext.haproxy.modules.haproxyconn.get_backend(backend, socket='/var/run/haproxy.sock')[source]¶
Receive information about a specific backend.
- backend
haproxy backend
- socket
haproxy stats socket, default
/var/run/haproxy.sock
CLI Example:
salt '*' haproxy.get_backend mysql
- saltext.haproxy.modules.haproxyconn.enable_server(name, backend, socket='/var/run/haproxy.sock')[source]¶
Enable Server in haproxy
- name
Server to enable
- backend
haproxy backend, or all backends if “*” is supplied
- socket
haproxy stats socket, default
/var/run/haproxy.sock
CLI Example:
salt '*' haproxy.enable_server web1.example.com www
- saltext.haproxy.modules.haproxyconn.disable_server(name, backend, socket='/var/run/haproxy.sock')[source]¶
Disable server in haproxy.
- name
Server to disable
- backend
haproxy backend, or all backends if “*” is supplied
- socket
haproxy stats socket, default
/var/run/haproxy.sock
CLI Example:
salt '*' haproxy.disable_server db1.example.com mysql
- saltext.haproxy.modules.haproxyconn.get_weight(name, backend, socket='/var/run/haproxy.sock')[source]¶
Get server weight
- name
Server name
- backend
haproxy backend
- socket
haproxy stats socket, default
/var/run/haproxy.sock
CLI Example:
salt '*' haproxy.get_weight web1.example.com www
- saltext.haproxy.modules.haproxyconn.set_weight(name, backend, weight=0, socket='/var/run/haproxy.sock')[source]¶
Set server weight
- name
Server name
- backend
haproxy backend
- weight
Server Weight
- socket
haproxy stats socket, default
/var/run/haproxy.sock
CLI Example:
salt '*' haproxy.set_weight web1.example.com www 13
- saltext.haproxy.modules.haproxyconn.set_state(name, backend, state, socket='/var/run/haproxy.sock')[source]¶
Force a server’s administrative state to a new state. This can be useful to disable load balancing and/or any traffic to a server. Setting the state to “ready” puts the server in normal mode, and the command is the equivalent of the “enable server” command. Setting the state to “maint” disables any traffic to the server as well as any health checks. This is the equivalent of the “disable server” command. Setting the mode to “drain” only removes the server from load balancing but still allows it to be checked and to accept new persistent connections. Changes are propagated to tracking servers if any.
- name
Server name
- backend
haproxy backend
- state
A string of the state to set. Must be ‘ready’, ‘drain’, or ‘maint’
- socket
haproxy stats socket, default
/var/run/haproxy.sock
CLI Example:
salt '*' haproxy.set_state my_proxy_server my_backend ready
- saltext.haproxy.modules.haproxyconn.show_frontends(socket='/var/run/haproxy.sock')[source]¶
Show HaProxy frontends
- socket
haproxy stats socket, default
/var/run/haproxy.sock
CLI Example:
salt '*' haproxy.show_frontends
- saltext.haproxy.modules.haproxyconn.list_frontends(socket='/var/run/haproxy.sock')[source]¶
List HaProxy frontends
- socket
haproxy stats socket, default
/var/run/haproxy.sock
CLI Example:
salt '*' haproxy.list_frontends
- saltext.haproxy.modules.haproxyconn.show_backends(socket='/var/run/haproxy.sock')[source]¶
Show HaProxy Backends
- socket
haproxy stats socket, default
/var/run/haproxy.sock
CLI Example:
salt '*' haproxy.show_backends
- saltext.haproxy.modules.haproxyconn.list_backends(servers=True, socket='/var/run/haproxy.sock')[source]¶
List HaProxy Backends
- socket
haproxy stats socket, default
/var/run/haproxy.sock
- servers
list backends with servers
CLI Example:
salt '*' haproxy.list_backends
- saltext.haproxy.modules.haproxyconn.get_sessions(name, backend, socket='/var/run/haproxy.sock')[source]¶
Added in version 2016.11.0.
Get number of current sessions on server in backend (scur)
- name
Server name
- backend
haproxy backend
- socket
haproxy stats socket, default
/var/run/haproxy.sock
CLI Example:
salt '*' haproxy.get_sessions web1.example.com www